This is for my Java CSC 210 course Write a quiz program that has the following p
ID: 3794433 • Letter: T
Question
This is for my Java CSC 210 course
Write a quiz program that has the following parts.
Part I. 3 true/false questions (you must use Booleans here).
Ask the user 3 questions, and after answering all of them check the answers. If any of the answers are wrong, this section must restart.
Part II. 3 number related questions, that make use of at least of these (>,>=, <=, <, !=, &&, ||, etc.) to check the correct answer.
The user should not be able to move forward on an incorrect answer. The program needs to keep asking the question, if a user gets it wrong.
Part III. 3 short answer questions.
If a user gets any of these questions wrong, the quiz should start from the beginning (Back to Part I).
Explanation / Answer
import java.io.*;
import java.util.Scanner;
class quiz
{
boolean ans;
Scanner sc=new Scanner(System.in);
void quizm()
{
System.out.println("1.is 100>99 Enter True Or False");
ans=sc.nextBoolean();
if(ans==true)
{
System.out.println("Correct Answer..!!");
System.out.println("2.is 100<10 Enter True Or False");
ans=sc.nextBoolean();
}
else
{
System.out.println("Ohh...U Entered an Wrong Answer Quiz Continued Once Again");
quizm();
}
if(ans==false)
{
System.out.println("Correct Answer..!!");
System.out.println("3.Is 200==200 Enter True Or False");
ans=sc.nextBoolean();
}
else
{
System.out.println("Ohh...U Entered an Wrong Answer Quiz Continued Once Again");
quizm();
}
if(ans==true)
{
System.out.println("Correct Answer..!!");
System.out.println("Quiz Completed U Have Answared All Question Correct!!");
}
else
{
System.out.println("Ohh...U Entered an Wrong Answer Quiz Continued Once Again");
quizm();
}
}
public static void main(String args[])
{
quiz q=new quiz();
q.quizm();
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.