C
cool_bubbly_babe
Guest
soon.TOPIC=Quiz contest? You gotta accept the name of 1 participant and its age through Stream Reader. If age if less than 18 yrs, dont ask qestions and ask to leave but if age is greater than or equal to 18, ask 20 questions and display score. End game if any answer is wrong. I have done it but it shows some error. Please correct it.PLZ!!PLZ!!!!. I need genuine answers.
import java.io.*;
class Bournvita_Quiz_Contest
{
static int age;
int score=0;
int a=20;
InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(ir);
public void result()
{
if(age>=18)
{
if(score==0)
{
System.out.println("I AM SORRY TO SAY BUT YOUR PERFORMANCE IS NOT AT ALL SATISFACTORY");
}
if(score==20)
{
System.out.println("WOW!!!");
System.out.println("CONGRATULATIONS!! You have won one lakh rupees ");
}
else
{
System.out.println("BETTER LUCK NEXT TIME!!!");
}
}
}
public void display()
{
System.out.println("===================================");
System.out.println("WELCOME TO 'BOURNVITA QUIZ CONTEST'");
System.out.println("===================================");
System.out.println("Just answer twenty simple questions correctly and win Rs.1,00,000");
System.out.println("LET US START THE CONTEST NOW");
}
public void accept()throws IOException
{
System.out.println("Dear participant, please furnish me with some details");
System.out.print("Your sweeet name:");
String name=br.readLine();
System.out.print("Your age:");
String n=br.readLine();
int age=Integer.parseInt
;
if(age<18)
{
System.out.println("YOU ARE NOT ELIGIBLE TO PARTICIPATE IN THIS CONTEST. YOU NEED TO BE OF AGE 18 YEARS AND ABOVE");
System.out.println("BETTER LUCK NEXT TIME");
System.out.println("You may leave");
}
System.out.println("CHOOSE THE CORRECT ANSWER");
}
public void ques1()throws IOException
{
if(age>=18)
{
System.out.println("What are Cheddar and Edam types of?");
System.out.println("1 : Cheese");
System.out.println("2 : Music");
System.out.println("3 : Rocks");
System.out.println("4 : Weapons");
System.out.println("Now,Select Your Answer");
String x=br.readLine();
a=Integer.parseInt(x);
if(a==1)
{
System.out.println("Correct Answer");
score=score+1;
}
else
{
System.out.println("Your first answer is wrong");
System.out.println("But you can test your level");
}
System.out.println("Your score is "+score);
}
}
public void ques2()throws IOException
{
if(age>=18)
{
System.out.println("By combining which two words is 'BRUNCH' formed?");
System.out.println("1 : Crunch and Munch");
System.out.println("2 : Bunch and Lunch");
System.out.println("3 : Breakfast and Lunch");
System.out.println("4 : Lunch and Dinner");
System.out.println("Select Your Answer");
String x=br.readLine();
a=Integer.parseInt(x);
if(a==3)
{
System.out.println("Correct Answer");
score=score+1;
}
else
{
System.out.println("Wrong answer");
System.out.println("But you can test your level");
}
System.out.println("Your score is "+score);
}
}
public void ques3()throws IOException
{
if(age>=18)
{
System.out.println("What do Numismatists collect?");
System.out.println("1 : Stamps");
System.out.println("2 : Pen");
System.out.println("3 : Books");
System.out.println("4 : Coins");
System.out.println("Select Your Answer");
String x=br.readLine();
a=Integer.parseInt(x);
if(a==4)
{
System.out.println("Correct Answer");
score=score+1;
}
else
{
System.out.println("Wrong answer");
System.out.println("But you can test your level");
import java.io.*;
class Bournvita_Quiz_Contest
{
static int age;
int score=0;
int a=20;
InputStreamReader ir=new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(ir);
public void result()
{
if(age>=18)
{
if(score==0)
{
System.out.println("I AM SORRY TO SAY BUT YOUR PERFORMANCE IS NOT AT ALL SATISFACTORY");
}
if(score==20)
{
System.out.println("WOW!!!");
System.out.println("CONGRATULATIONS!! You have won one lakh rupees ");
}
else
{
System.out.println("BETTER LUCK NEXT TIME!!!");
}
}
}
public void display()
{
System.out.println("===================================");
System.out.println("WELCOME TO 'BOURNVITA QUIZ CONTEST'");
System.out.println("===================================");
System.out.println("Just answer twenty simple questions correctly and win Rs.1,00,000");
System.out.println("LET US START THE CONTEST NOW");
}
public void accept()throws IOException
{
System.out.println("Dear participant, please furnish me with some details");
System.out.print("Your sweeet name:");
String name=br.readLine();
System.out.print("Your age:");
String n=br.readLine();
int age=Integer.parseInt

if(age<18)
{
System.out.println("YOU ARE NOT ELIGIBLE TO PARTICIPATE IN THIS CONTEST. YOU NEED TO BE OF AGE 18 YEARS AND ABOVE");
System.out.println("BETTER LUCK NEXT TIME");
System.out.println("You may leave");
}
System.out.println("CHOOSE THE CORRECT ANSWER");
}
public void ques1()throws IOException
{
if(age>=18)
{
System.out.println("What are Cheddar and Edam types of?");
System.out.println("1 : Cheese");
System.out.println("2 : Music");
System.out.println("3 : Rocks");
System.out.println("4 : Weapons");
System.out.println("Now,Select Your Answer");
String x=br.readLine();
a=Integer.parseInt(x);
if(a==1)
{
System.out.println("Correct Answer");
score=score+1;
}
else
{
System.out.println("Your first answer is wrong");
System.out.println("But you can test your level");
}
System.out.println("Your score is "+score);
}
}
public void ques2()throws IOException
{
if(age>=18)
{
System.out.println("By combining which two words is 'BRUNCH' formed?");
System.out.println("1 : Crunch and Munch");
System.out.println("2 : Bunch and Lunch");
System.out.println("3 : Breakfast and Lunch");
System.out.println("4 : Lunch and Dinner");
System.out.println("Select Your Answer");
String x=br.readLine();
a=Integer.parseInt(x);
if(a==3)
{
System.out.println("Correct Answer");
score=score+1;
}
else
{
System.out.println("Wrong answer");
System.out.println("But you can test your level");
}
System.out.println("Your score is "+score);
}
}
public void ques3()throws IOException
{
if(age>=18)
{
System.out.println("What do Numismatists collect?");
System.out.println("1 : Stamps");
System.out.println("2 : Pen");
System.out.println("3 : Books");
System.out.println("4 : Coins");
System.out.println("Select Your Answer");
String x=br.readLine();
a=Integer.parseInt(x);
if(a==4)
{
System.out.println("Correct Answer");
score=score+1;
}
else
{
System.out.println("Wrong answer");
System.out.println("But you can test your level");