This code is meant to be a simple quiz, but I am getting 4 errors that I cannot figure out. Thanks in advance.
import java.io.*;
public class Quiz
{
public static void main(String args[])
{
int correctCounter;
InputStreamReader reader;
BufferedReader buffer;
keyboard = new BufferedReader (new InputStreamReader (System.in));
}
String seekResponse;
{ System.out.println("Welcome to Dan's Quiz .. ");
{
// choose the subject
System.out.println("enter M for Math, S for Science or x for exit");
seekResponse = keyboard.readline();
if (seekResponse.equals ("M")) //Select the Math quiz
{
System.out.println("What is the sum of 120 & 120?"); //Math Question1
System.out.printIn("a. 0");
System.out.printIn("b. 240");
System.out.printIn("c. 220");
System.out.printIn("Press X to exit");
seekResponse = keyboard.readline();
if (seekResponse=("a"))
System.out.println("incorrect answer");
if (seekResponse.equals ("b"))
System.out.println("correct");
if (seekResponse.equals ("c"))
System.out.println("incorrect answer");
else if (seekResponse.equals ("x"))
exit; // do exit logic
System.out.println("What is the product of 12 & 12?"); //Math Question2 Line34
System.out.printIn("a. 144");
System.out.printIn("b. 24");
System.out.printIn("c. 1");
System.out.printIn("Press X to exit");
if (seekResponse.equals ("a"))
System.out.println("correct answer");
if (seekResponse.equals ("b"))
System.out.println("incorrect answer");
if (seekResponse.equals ("c"))
System.out.println("incorrect answer");
else if (seekResponse.equals ("x"))
exit;// do exit logic
}
else if (seekResponse.equals ("S")); //Select the Science quiz
{
System.out.println("A snake is a member of which animal group?"); //Science Question1
seekResponse = keyboard.readline();
System.out.printIn("a. Mammal");
System.out.printIn("b. Amphibian");
System.out.printIn("c. Reptile");
if (seekResponse.equals ("a"))
System.out.println("incorrect answer");
if (seekResponse.equals ("b"))
System.out.println("incorrect answer");
if (seekResponse.equals ("c"))
System.out.println("correct");
}
{
else if (seekResponse.equals ("x"))
exit;// do exit logic
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.