What would be the algorithm form of the following program:-

``````import java.util.*;
public class quizcontest {
Scanner sc=new Scanner(System.in);
String name;
int ans1,ans2,ans3,ans4,ans5;   //declaring variable//
void acceptname()
{System.out.println("****************************");
name=sc.next();
System.out.println("****************************");
System.out.println("+++++Best Of Luck ! "+name+" +++++");
}
void sports()
{
System.out.println("Here Starts Our Quiz ");
System.out.println("==========**********==========**********");
System.out.println("ques 1.  who has taken overas the director of \n"
+ "operationsat the banglore based national cricket academy in"
+ " place of his predecessor dave what more than joined IPL"
+ " team kolkata Knight riders recently ? ");
System.out.println("----------------------------------------");
System.out.println("1.) Kapil Dev");
System.out.println("3.) Sandeep Patil");
System.out.println("4.) Karsan Gharvi");
System.out.println("----------------------------------------");
ans1=sc.nextInt();
if(ans1==3)
{   System.out.println(".......................................");
System.out.println("you gain Rs. 1000");
System.out.println("....................................");

}
else
{
System.out.println("");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is Sandeep Patil");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(1);

}        System.out.println("==========**********==========**********");
System.out.println("ques 2.  Of which two sports have actors Mohanlal\n"
+ " and Mammootty became good while ambasadors in kerala recently ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Judo and TableTennis");
System.out.println("2.)  Athletics and Vollyball");
System.out.println("4.)  Football and Boat racing");
ans1=sc.nextInt();
System.out.println("----------------------------------------");
if(ans1==2)
{System.out.println(".......................................");
System.out.println("you gain Rs. 2500");
System.out.println(".......................................");

}
else
{   System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is Athletics and Vollyball");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(1);

}        System.out.println("==========**********==========**********");
System.out.println("ques 3.  Olympic Gold Medallist Abhinav Bindra will\n"
+ " be the new face to promote Guns made by which company ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Walther");
System.out.println("2.)  Mouser");
System.out.println("3.)  Uzi");
System.out.println("4.)  Colt");
ans1=sc.nextInt();
System.out.println("----------------------------------------");
if(ans1==1)
{System.out.println(".......................................");
System.out.println("you gain Rs. 5000");
System.out.println(".......................................");

}
else
{   System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(1);

}
System.out.println("==========**********==========**********");
System.out.println("ques 4.  Who Won the Shanghi Masters Tennis \n"
+ "Tournament Organized Recently ? ");
System.out.println("----------------------------------------");
System.out.println("2.)  Roger Federer");
System.out.println("3.)  Nikolay Davydenko");
System.out.println("4.)  Andy Murray");
ans1=sc.nextInt();
System.out.println("----------------------------------------");
if(ans1==3)
{System.out.println(".......................................");
System.out.println("you gain Rs. 7500");
System.out.println(".......................................");

}
else
{   System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is Nikolay Davydenko");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(1);

}

System.out.println("==========**********==========**********");
System.out.println("ques 5.  Who Won the 2009 FIFA under 17 world-cup \n"
+ "in Abuja,Nigeria Recently ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Mexico");
System.out.println("2.)  Brazil");
System.out.println("3.)  Switzerland");
System.out.println("4.)  Netherlands");
ans1=sc.nextInt();
System.out.println("----------------------------------------");

if(ans1==3)
{System.out.println(".......................................");
System.out.println("you won 9000");
System.out.println(".......................................");

}
else
{   System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(1);

}        System.out.println("==========**********==========**********");
System.out.println("ques 6.  Which well known Olympic Gold \n"
+ "Medallist is Chairman of London Organising committee\n"
+ " for the Olympic Games ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Daley Thompson");
System.out.println("2.)  Sebastin Coe");
System.out.println("3.)  Steve Overt");
System.out.println("4.)  Robin Cousins");
ans1=sc.nextInt();
System.out.println("----------------------------------------");
if(ans1==2)
{System.out.println(".......................................");
System.out.println("you won Rs. 10000");
System.out.println("And with this You have Completed the Quiz");
System.out.println(".......................................");

}
else
{   System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is Sebastin Coe");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(1);

}        System.out.println("==========**********==========**********");

}
void computer()
{

System.out.println("Here Starts Our Quiz ");
System.out.println("==========**********==========**********");
System.out.println("ques 1.  A program which can infect copy \n"
+ "itself and Infect a computer without the knowledge \n"
+ "of owner is called ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Floppy");
System.out.println("2.)  Virus");
System.out.println("3.)  java");
System.out.println("4.)  Moniter");
ans2=sc.nextInt();
System.out.println("----------------------------------------");
if(ans2==2)
{ System.out.println(".......................................");
System.out.println("you won Rs. 1000");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(2);

}System.out.println("==========**********==========**********");
System.out.println("ques 2.  which of this is correct format of IP address ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  192.168.1.1");
System.out.println("2.)  192.168.111.1111");
System.out.println("3.)  192.168.900.1");
System.out.println("4.)  192.900.168.1");
ans2=sc.nextInt();
System.out.println("----------------------------------------");
if(ans2==1)
{System.out.println(".......................................");
System.out.println("you won Rs. 2500");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(2);

}System.out.println("==========**********==========**********");
System.out.println("ques 3.  Which of this is the First web Browser ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  WorldWideWeb");
System.out.println("2.)  NetscapeNavigator");
System.out.println("3.)  Internet Explorer");
System.out.println("4.)  Safari");
ans2=sc.nextInt();
System.out.println("----------------------------------------");
if(ans2==1)
{System.out.println(".......................................");
System.out.println("you won Rs. 5000");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(2);

}System.out.println("==========**********==========**********");
System.out.println("ques 4. What does HTTP stands for ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Hyper Text Transfer Protocol");
System.out.println("2.)  Hyper Text Transfer Plotter");
ans2=sc.nextInt();
System.out.println("----------------------------------------");
if(ans2==1)
{System.out.println(".......................................");
System.out.println("you won Rs. 7500");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is Hyper Text Transfer Protocol");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(2);

}System.out.println("==========**********==========**********");
System.out.println("ques 5.  Which company is nicknamed big blue ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  TCS");
System.out.println("2.)  IBM");
System.out.println("3.)  Microsoft");
System.out.println("4.)  Satyam");
ans2=sc.nextInt();
System.out.println("----------------------------------------");
if(ans2==3)
{System.out.println(".......................................");
System.out.println("you won Rs. 9000");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(2);

}System.out.println("==========**********==========**********");
System.out.println("ques 6.  In computer,What is the smallest unit of \n"
+ "information Storage ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Bit");
System.out.println("2.)  Byte");
System.out.println("3.)  Megabyte");
System.out.println("4.)  Newton");
ans2=sc.nextInt();
System.out.println("----------------------------------------");
if(ans2==1)
{System.out.println(".......................................");
System.out.println("You won Rs. 10000");
System.out.println("And with this you have completed the quiz");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(2);

}System.out.println("==========**********==========**********");
}
void Indianhistory()
{
System.out.println("Here Starts Our Quiz ");
System.out.println("==========**********==========**********");
System.out.println("ques 1.  Delhi was declared as the Capital of India in the year __ ? ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  1900");
System.out.println("2.)  1905");
System.out.println("3.)  1911");
System.out.println("4.)  1920");
ans3=sc.nextInt();
System.out.println("----------------------------------------");
if(ans3==3)
{System.out.println(".......................................");
System.out.println("you won Rs. 1000");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(3);
}

System.out.println("==========**********==========**********");
System.out.println("ques 2.  India’s first General Election was in the year __ ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  1948-49");
System.out.println("2.)  1949-50");
System.out.println("3.)  1950-51");
System.out.println("4.)  1951-52");
ans3=sc.nextInt();
System.out.println("----------------------------------------");
if(ans3==4)
{System.out.println(".......................................");
System.out.println("you won Rs. 2500");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(3);
}
System.out.println("==========**********==========**********");
System.out.println("ques 3.  The Indigo Revolt taken place in __  ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Bengal");
System.out.println("2.)  Delhi");
System.out.println("3.)  Mumbai");
System.out.println("4.)  Surat");
ans3=sc.nextInt();
System.out.println("----------------------------------------");
if(ans3==1)
{System.out.println(".......................................");
System.out.println("you won Rs. 5000");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is Bengal in 1859");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(3);
}
System.out.println("ques 4.  The main metal used by the Indus Valley people was  ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Iron");
System.out.println("2.)  Copper");
System.out.println("3.)  Aluminium");
System.out.println("4.)  Bronze");
ans3=sc.nextInt();
System.out.println("----------------------------------------");
if(ans3==2)
{System.out.println(".......................................");
System.out.println("you won Rs. 7500");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(3);
}
System.out.println("ques 5.  Gandhiji published ‘Hindi Swaraj’ in the year __ ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  1903");
System.out.println("2.)  1905");
System.out.println("3.)  1911");
System.out.println("4.)  1908");
ans3=sc.nextInt();
System.out.println("----------------------------------------");
if(ans3==4)
{System.out.println(".......................................");
System.out.println("you won Rs. 9000");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(3);

}
System.out.println("ques 6.  Which place in India was Gandhi’s first Satyagraha held at ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Champaran");
System.out.println("2.)  Dandi");
System.out.println("3.)  Kheda");
System.out.println("4.)  Surat");
ans3=sc.nextInt();
System.out.println("----------------------------------------");
if(ans3==1)
{System.out.println(".......................................");
System.out.println("you won Rs. 10000");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is Champaran in 1917");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(3);

}

}
void science_ph()
{
System.out.println("Here Starts Our Quiz ");
System.out.println("==========**********==========**********");
System.out.println("ques 1.  Which Instrument is used to measure Pressure ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Sccharimeter");
System.out.println("2.)  Ammeter");
System.out.println("3.)  Manometer");
System.out.println("4.)  Lactometer");
ans4=sc.nextInt();
System.out.println("----------------------------------------");
if(ans4==3)
{System.out.println(".......................................");
System.out.println("you won Rs. 1000");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(4);

}System.out.println("==========**********==========**********");
System.out.println("ques 2.  What does Angstrom measure ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Quantity of Liquid");
System.out.println("2.)  Length of Light wave");
System.out.println("3.)  Length of cables");
System.out.println("4.)  Speed of Ships");
ans4=sc.nextInt();
System.out.println("----------------------------------------");
if(ans4==2)
{System.out.println(".......................................");
System.out.println("you won Rs. 2500");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is Speed of Ships");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(4);

}System.out.println("==========**********==========**********");
System.out.println("ques 3.  Light year is related to ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Energy");
System.out.println("2.)  Speed");
System.out.println("3.)  Distance");
System.out.println("4.)  Intensity");
ans4=sc.nextInt();
System.out.println("----------------------------------------");
if(ans4==3)
{System.out.println(".......................................");
System.out.println("you Won Rs. 5000");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(4);

}System.out.println("==========**********==========**********");
System.out.println("ques 4.  How many Dynes are their in 1 gram weight ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  900");
System.out.println("2.)  375");
System.out.println("3.)  981");
System.out.println("4.)  250");
ans4=sc.nextInt();
System.out.println("----------------------------------------");
if(ans4==3)
{System.out.println(".......................................");
System.out.println("you won Rs. 7500");
System.out.println(".......................................");

}
else
{System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(4);

}System.out.println("==========**********==========**********");
System.out.println("ques 5.  The unit of current is ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Ohm");
System.out.println("2.)  watt");
System.out.println("3.)  Amphere");
System.out.println("4.)  none of these");
ans4=sc.nextInt();
System.out.println("----------------------------------------");
if(ans4==3)
{   System.out.println(".......................................");
System.out.println("you won Rs. 9000");
System.out.println(".......................................");
}
else
{   System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(4);

}       System.out.println("==========**********==========**********");
System.out.println("ques 6.  Centegrade and Fahrenheit scale give same reading at ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  -40 degree");
System.out.println("2.)  -32 degree");
System.out.println("3.)  -273 degree");
System.out.println("4.)  -100 degree");
ans4=sc.nextInt();
System.out.println("----------------------------------------");
if(ans4==1)
{   System.out.println(".......................................");
System.out.println("you won Rs. 10000");
System.out.println("And with this you have completed the Quiz");
System.out.println(".......................................");

}
else
{   System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is -40 degree");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(4);

}System.out.println("==========**********==========**********");
}
void generalknowlege()
{
System.out.println("Here Starts Our Quiz ");
System.out.println("******************************");
System.out.println("ques 1.  who is the first president of \n"
+ "United States of America ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  George Washington");
System.out.println("2.)  Thomas Jefferson");
System.out.println("3.)  James Monroe");
ans5=sc.nextInt();
System.out.println("----------------------------------------");
if(ans5==1)
{   System.out.println(".......................................");
System.out.println("you won Rs. 1000");
System.out.println(".......................................");

}
else
{   System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is George Washington");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(5);

}      System.out.println("==========**********==========**********");
System.out.println("ques 2.  Who was born on August 15,1769 ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Winston Churchill");
System.out.println("2.)  Queen Victoria");
System.out.println("3.)  Napoleon bonaparte");
System.out.println("4.)  George V");
ans5=sc.nextInt();
System.out.println("----------------------------------------");
if(ans5==3)
{   System.out.println(".......................................");
System.out.println("you won Rs. 2500");
System.out.println(".......................................");

}
else
{   System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is Napoleon bonaparte");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(5);

}      System.out.println("==========**********==========**********");
System.out.println("ques 3.  Which is National Flower of Australia ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Red Rose");
System.out.println("2.)  Lotus");
System.out.println("3.)  Tulip");
System.out.println("4.)  Golden Wattle");
ans5=sc.nextInt();
System.out.println("----------------------------------------");
if(ans5==1)
{   System.out.println(".......................................");
System.out.println("you won Rs. 5000");
System.out.println(".......................................");

}
else
{   System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("the correct answer is Red Rose");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(5);

}      System.out.println("==========**********==========**********");
System.out.println("ques 4.  What is the number of Square's on a chess boad ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  72");
System.out.println("2.)  64");
System.out.println("3.)  32");
System.out.println("4.)  48");
ans5=sc.nextInt();
System.out.println("----------------------------------------");
if(ans5==2)
{   System.out.println(".......................................");
System.out.println("you won Rs. 7500");
System.out.println(".......................................");

}
else
{  System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(5);

}      System.out.println("==========**********==========**********");
System.out.println("ques 5.  Which city was the Summer Capital of India During British Rule ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Nanital");
System.out.println("2.)  Dargeeling");
System.out.println("3.)  Simla");
System.out.println("4.)  Ooty");
ans5=sc.nextInt();
System.out.println("----------------------------------------");
if(ans5==3)
{   System.out.println(".......................................");
System.out.println("you won Rs. 9000");
System.out.println(".......................................");

}
else
{  System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(5);

}      System.out.println("==========**********==========**********");
System.out.println("ques 6.  The name of which city was changed to Petrograd and Leningrad ? ");
System.out.println("----------------------------------------");
System.out.println("1.)  Moscow");
System.out.println("3.)  Kiev");
System.out.println("4.)  St.petersburg");
ans5=sc.nextInt();
System.out.println("----------------------------------------");
if(ans5==4)
{   System.out.println(".......................................");
System.out.println("you won Rs. 10000");
System.out.println("And with this you have Completed the Game");
System.out.println(".......................................");

}
else
{   System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.out.println("sorry "+name+" try again !");
System.out.println("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
System.exit(5);

}System.out.println("==========**********==========**********");
}
public static void main(String ar[])
{
Scanner sc=new Scanner(System.in);
int choice;
quizcontest q1=new quizcontest();
System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
System.out.println("^^^^^Welcome To The World Of Queries?^^^^^");
System.out.println("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
System.out.println();
System.out.println("basic Instructions ");
System.out.println("you have to enter your name ");
System.out.println("then you have to choose any one category\n that you like out of five");
System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
System.out.println("enter 1 for sports");
System.out.println("enter 2 for computer");
System.out.println("enter 3 for Indian History");
System.out.println("enter 4 for Science(Physics)");
System.out.println("enter 5 for general knowledge");
choice=sc.nextInt();
System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
System.out.println("Now answer of any question is to be given by its option number.");
System.out.println("If you give a wrong answer than the program will terminate and \nif correct than the next question appears.");

System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
q1.acceptname();

switch(choice)
{
case 1:
{
q1.sports();
break;
}
case 2:
{
q1.computer();
break;
}
case 3:
{
q1.Indianhistory();
break;
}
case 4:
{
q1.science_ph();
break;
}
case 5:
{
q1.generalknowlege();
break;
}
}
System.out.println("/*/*/*/*/*/*/*Thank You For Playing The Quiz/*/*/*/*/*/*/* ");

}
}``````

Edited by peter_budo: Keep It Clear - Do use code tags when posting any code

4
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by stultuske

@kartik1997 your question is not clear so you better provide more in details explanation. By looking at the above code I would be surprised if it does compile

not to mention this looks like a LOT of repeating code.
it's not so difficult to create a class containing: