public class code
{
public static void main(String args[])throws Exception
{
int numberofcorrect = 0;
for(int x = 0; x<10; x++)
{
String[]questions = {"1. 5+5=?","2. 10+15=?","3. 4+8=?",
"4. 51+52=?","5. 10+91=?","6. 13+12=?",
"7. 8*2=?","8. 5*2=?","9. 2*7=?",
"10.8*9=?"};
String[]answers = {"a. 10 b. 45 c. 65" , "a.45 b. 25 c.74",
"a.5 b.12 c.89" , "a.103 b.145 c.147",
"a.125 b.104 c.101" , "a.48 b.25 c.87",
"a.92 b.61 c.16" , "a.10 b.47 c.40",
"a.13 b.17 c.14" , "a.72 b.82 c.42",};
char[]trueanswers = {'a','b','b','a','c','b','c','a','c','a'};
System.out.println(questions[x]);
System.out.println(answers[x]);
char input;
input =(char)System.in.read();System.in.read();System.in.read();
if(input == trueanswers[x])
{
System.out.println("you’re correct!!");
numberofcorrect++;
}
else
{
System.out.println("sorry!, you’re wrong!!");
System.out.println("the correct answer is letter " + trueanswers[x]);
}
}
System.out.println("\n You had " + numberofcorrect + " correct answers out of 10 items.\n ");
if(numberofcorrect>=5)
{
System.out.println("Good job,. You've passed the quiz!!!");
}
else
{
System.out.println("sorry,. you did'nt passed the quiz!!");}
}
}
}
public static void main(String args[])throws Exception
{
int numberofcorrect = 0;
for(int x = 0; x<10; x++)
{
String[]questions = {"1. 5+5=?","2. 10+15=?","3. 4+8=?",
"4. 51+52=?","5. 10+91=?","6. 13+12=?",
"7. 8*2=?","8. 5*2=?","9. 2*7=?",
"10.8*9=?"};
String[]answers = {"a. 10 b. 45 c. 65" , "a.45 b. 25 c.74",
"a.5 b.12 c.89" , "a.103 b.145 c.147",
"a.125 b.104 c.101" , "a.48 b.25 c.87",
"a.92 b.61 c.16" , "a.10 b.47 c.40",
"a.13 b.17 c.14" , "a.72 b.82 c.42",};
char[]trueanswers = {'a','b','b','a','c','b','c','a','c','a'};
System.out.println(questions[x]);
System.out.println(answers[x]);
char input;
input =(char)System.in.read();System.in.read();System.in.read();
if(input == trueanswers[x])
{
System.out.println("you’re correct!!");
numberofcorrect++;
}
else
{
System.out.println("sorry!, you’re wrong!!");
System.out.println("the correct answer is letter " + trueanswers[x]);
}
}
System.out.println("\n You had " + numberofcorrect + " correct answers out of 10 items.\n ");
if(numberofcorrect>=5)
{
System.out.println("Good job,. You've passed the quiz!!!");
}
else
{
System.out.println("sorry,. you did'nt passed the quiz!!");}
}
}
}

No comments:
Post a Comment