SlideShare a Scribd company logo
package Games; 
import java.util.*; 
public class KBC 
{ 
String questions[]; 
String options[][]; 
int answers[]; 
long money[]; 
int history[]; 
boolean lifelines[]; 
static int games=0; 
public int getRandomQuestion() 
{ 
int i=(int)((Math.random()*questions.length)); 
return i; 
} 
public KBC() //constructor 
{ 
questions=new String[] 
{ 
"Who discovered Uranus? ", 
"According to Hindu Mythology, which of these is a 
brother of God Krishna ?", 
" In the U.S., something traditional is often said to be 
"as American as" what?", 
"The velocity of light was first measured by", 
"Study of life in outer space is known as", 
"Oncology is the study of ", 
"What was the name of India's first unmanned lunar 
spacecraft launched in October 2008?", 
"The credit of developing the polio vaccine goes to", 
"The scientist who first discovered that the earth 
revolves round the sun was", 
"Centigrade & Fahrenheit scales give same reading at", 
"The unit of energy in MKS system is", 
"Which of the following instruments is used to measure 
pressure of gases?", 
"Where is the headquarters of Microsoft located?", 
"'.BAT' extension refers usually to what kind of file?", 
"What is the highest score in international test 
cricket?", 
"What was the overall medal tally for the Indian 
contingent at the Glasgow Commonwealth Games 2014?", 
"Which of these laws helps specifically in calculating 
current in complex circuits with multiple cells?", 
"The photoelectric effect was explained effectively by 
Einstein on the basis of what?" 
}; 
options=new String[][] 
{
{"1. Herschel ", "2. Galileo", "3. Copernicus ", "4. 
None of these "}, 
{"1. Ram ", "2. Balram ", "3. Arjun ", "4. Parsuram"}, 
{"1. Apple Pie ", "2. Franks and Beans ", "3. American 
Pie ", "4. Macaroni and cheese "}, 
{"1. Einstein", "2. Newton ", "3. Romer ", "4. Galileo 
"}, 
{"1. Endobiology ", "2. Exobiology", "3. Enterobiology 
", "4. Neobiology "}, 
{"1. Birds", "2. Cancer", "3. Mammals", "4. Soil"}, 
{"1. Chandravahaan 1" , "2. Chandrayaan 1 ", "3. 
Chandravimaan 1", "4. Chadrakhoj 1"}, 
{"1. Jonas Salk ", "2. Alb E. Sabin ", "3. Selman 
Waksman ", "4. None of these "}, 
{"1. Newton", "2. Dalton", "3. Copernicus", "4. 
Einstein"}, 
{"1. -40 degree", "2. -32 degree", "3. -273 degree", "4. 
-100 degree"}, 
{"1. Volt", "2. Erg", "3. Ohm", "4. Joule"}, 
{"1. Barometer ", "2. Manometer ", "3. Saccharimeter ", 
"4. Lactometer "}, 
{"1. Santa Clara, California ", "2. Tucson, Arizona ", 
"3. Richmond, Virginia ", "4. Redmond, Washington"}, 
{"1. Compressed Archive file ", "2. System file ", "3. 
Audio file ", "4. Backup file "}, 
{"1. 333","2. 427","3. 400*","4. 512"}, 
{"1. 62","2. 58","3. 64","4. 65" }, 
{"1. Kirchoff's law","2. Coulomb's law","3. Ohm's 
law","4. Gauss' theorem"}, 
{"1. Special relativity","2. Planck's quantum 
theory","3. Rutherford's postulates","4. Crystal field theory"} 
}; 
answers=new int[]{1,2,1,3,2,2,2,1,3,1,4,2,4,2,3,3,1,2}; 
money=new long[] 
{1000,3000,5000,10000,25000,50000,75000,100000,250000,500000,1000000 
,2500000,5000000,7500000,10000000}; 
history=new int[18]; 
lifelines=new boolean[]{false,false,false}; 
} 
public static void main() 
{ 
Scanner sc= new Scanner(System.in); 
int choice= 0; 
if(games==10) 
System.out.println("get a life"); 
if(games==0) 
System.out.println("fWelcome to KBCnn"); 
System.out.println("Your First Question is :n"); 
KBC k= new KBC(); //object 
int n=0;//no of questions completed 
for(int i=0;i<k.questions.length;i++) 
{
int r; 
do 
{ 
r= k.getRandomQuestion(); 
}while(k.history[r]==1); //loop goes till question is 
found which has not been asked yet 
System.out.println(k.questions[r]); 
System.out.println(k.options[r][0]); 
System.out.println(k.options[r][1]); 
System.out.println(k.options[r][2]); 
System.out.println(k.options[r][3]); 
System.out.println("Press 1,2,3 or 4nIf you do not know 
the answer enter 0 to use a lifeline"); 
choice= sc.nextInt(); 
while(choice>4) 
{ 
System.out.println("Please enter only 0,1,2,3 or 
4"); 
choice=sc.nextInt(); 
} 
if(choice==0) 
{ 
boolean boo=true; 
if(k.lifelines[0]==true && k.lifelines[1]==true && 
k.lifelines[2]==true) 
boo=false; 
if(boo){ 
System.out.println("Enter 1 to use 50/50nEnter 2 to 
ask RajnikanthnEnter 3 to change the question"); 
int c=sc.nextInt()-1; 
while(k.lifelines[c]==true) 
{ 
System.out.println("Sorry you have used this 
lifeline. Please choose another by entering the respective 
number."); 
c=sc.nextInt()-1; 
} 
k.lifelines[c]=true; 
switch(c) 
{ 
case 0: 
int rand; 
do{ 
rand=(int)(Math.random()*4); 
}while(rand==(k.answers[i]-1)); 
if(rand<(k.answers[r]-1)) 
System.out.println("The remaining options 
aren"+k.options[r][rand]+"n"+k.options[r][(k.answers[r]-1)]); 
else 
System.out.println("The remaining options 
aren"+k.options[r][(k.answers[r]-1)]+"n"+k.options[r][rand]); 
break;
case 1: 
System.out.println("Rajnikanth says the 
answer is "+k.answers[r]); 
break; 
case 2: 
k.history[r]=1; 
System.out.println("fYour new question is: 
n"); 
continue; 
} 
} 
else 
System.out.println("Sorry you have used all your 
lifelines."); 
System.out.println("What is your final answer?"); 
choice=sc.nextInt(); 
} 
n++; 
if(choice==k.answers[r]) 
{ 
if(n==15) 
System.out.println("nCorrect answer 
nCONGRATULATIONS!!!YOU ARE A CROREPATI!nYou Won Rs."+k.money[i] 
+"nnThanks for playing :)"); 
else 
System.out.println("nCorrect answernYou Won 
Rs."+k.money[i]+"n"); 
} 
else 
{ 
System.out.println("nYou LostnnGame Over !!"); 
if(i>=1) 
System.out.println("Your total prize 
money :Rs."+k.money[i-1]); 
else 
System.out.println("Your total prize money :Rs.0"); 
break; 
} 
k.history[r]=1; //indicates question is completed 
System.out.println("Enter any letter to continue"); 
String v=sc.next(); 
System.out.println("f");//refresh feed 
} 
System.out.println("Do you want to play again?(y/n)"); 
char c=sc.next().charAt(0); 
if(c=='y' || c=='Y') 
{ 
games++; 
main(); 
} 
else 
System.out.println("Thanks for playing!"); 
} 
}
KBC (Java Program written on Blue J Editor)

More Related Content

What's hot

Презентація:Комп"ютери та їх різновиди
Презентація:Комп"ютери та їх різновидиПрезентація:Комп"ютери та їх різновиди
Презентація:Комп"ютери та їх різновиди
sveta7940
 
Tic tac toe c++ project presentation
Tic tac toe c++ project presentationTic tac toe c++ project presentation
Tic tac toe c++ project presentation
Saad Symbian
 
Презентація на тему: Робота з програмаю фотошоп
Презентація на тему: Робота з програмаю фотошопПрезентація на тему: Робота з програмаю фотошоп
Презентація на тему: Робота з програмаю фотошоп
popka2
 
Aliens and ufo's
Aliens and ufo'sAliens and ufo's
Aliens and ufo's
douglas1441
 

What's hot (20)

Інформатика-5. Урок 5. Персональний комп'ютер та його складові
Інформатика-5. Урок 5. Персональний комп'ютер та його складовіІнформатика-5. Урок 5. Персональний комп'ютер та його складові
Інформатика-5. Урок 5. Персональний комп'ютер та його складові
 
5 клас 7 урок. Об’єкти. Властивості об’єктів, значення властивостей. Об’єкти ...
5 клас 7 урок. Об’єкти. Властивості об’єктів, значення властивостей. Об’єкти ...5 клас 7 урок. Об’єкти. Властивості об’єктів, значення властивостей. Об’єкти ...
5 клас 7 урок. Об’єкти. Властивості об’єктів, значення властивостей. Об’єкти ...
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac Toe
 
Презентація:Комп"ютери та їх різновиди
Презентація:Комп"ютери та їх різновидиПрезентація:Комп"ютери та їх різновиди
Презентація:Комп"ютери та їх різновиди
 
Tic Tac Toe ppt
Tic Tac Toe pptTic Tac Toe ppt
Tic Tac Toe ppt
 
AI3391 Artificial Intelligence Session 19 stochastics games.pptx
AI3391 Artificial Intelligence Session 19 stochastics games.pptxAI3391 Artificial Intelligence Session 19 stochastics games.pptx
AI3391 Artificial Intelligence Session 19 stochastics games.pptx
 
Комп’ютерні мережі та інтернет
Комп’ютерні мережі та інтернетКомп’ютерні мережі та інтернет
Комп’ютерні мережі та інтернет
 
An Introduction To UFOs
An Introduction To UFOsAn Introduction To UFOs
An Introduction To UFOs
 
AI_Unit I notes .pdf
AI_Unit I notes .pdfAI_Unit I notes .pdf
AI_Unit I notes .pdf
 
Tic tac toe c++ project presentation
Tic tac toe c++ project presentationTic tac toe c++ project presentation
Tic tac toe c++ project presentation
 
Aliens
AliensAliens
Aliens
 
project report in C++ programming and SQL
project report in C++ programming and SQLproject report in C++ programming and SQL
project report in C++ programming and SQL
 
Презентація на тему: Робота з програмаю фотошоп
Презентація на тему: Робота з програмаю фотошопПрезентація на тему: Робота з програмаю фотошоп
Презентація на тему: Робота з програмаю фотошоп
 
Artificial Intelligence Notes Unit 3
Artificial Intelligence Notes Unit 3Artificial Intelligence Notes Unit 3
Artificial Intelligence Notes Unit 3
 
моя презентация безпечний интернет
моя презентация безпечний интернетмоя презентация безпечний интернет
моя презентация безпечний интернет
 
8 клас урок 4
8 клас урок 48 клас урок 4
8 клас урок 4
 
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdfAI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
AI3391 ARTIFICIAL INTELLIGENCE UNIT II notes.pdf
 
презентація сервіси розміщення відео та аудіо
презентація   сервіси розміщення відео та аудіопрезентація   сервіси розміщення відео та аудіо
презентація сервіси розміщення відео та аудіо
 
Kali Linux
Kali LinuxKali Linux
Kali Linux
 
Aliens and ufo's
Aliens and ufo'sAliens and ufo's
Aliens and ufo's
 

Viewers also liked (11)

kaun banega crorepati
kaun banega crorepatikaun banega crorepati
kaun banega crorepati
 
Kaun banega crorepati
Kaun banega crorepatiKaun banega crorepati
Kaun banega crorepati
 
Pokemon battle simulator (Java Program written on Blue J Editor)
Pokemon battle simulator (Java Program written on Blue J Editor)Pokemon battle simulator (Java Program written on Blue J Editor)
Pokemon battle simulator (Java Program written on Blue J Editor)
 
Who Wants To Be A Millionaire Template
Who Wants To Be A Millionaire TemplateWho Wants To Be A Millionaire Template
Who Wants To Be A Millionaire Template
 
Fyp ideas
Fyp ideasFyp ideas
Fyp ideas
 
Blue ocean strategy of kbc(star plus) by deepak
Blue ocean strategy of kbc(star plus) by deepakBlue ocean strategy of kbc(star plus) by deepak
Blue ocean strategy of kbc(star plus) by deepak
 
El patito que le gusta pintar
El patito que le gusta pintarEl patito que le gusta pintar
El patito que le gusta pintar
 
Cricket Management System
Cricket Management SystemCricket Management System
Cricket Management System
 
CRICKET
CRICKETCRICKET
CRICKET
 
PROJECT REPORT_ONLINE VOTING SYSTEM
PROJECT REPORT_ONLINE VOTING SYSTEMPROJECT REPORT_ONLINE VOTING SYSTEM
PROJECT REPORT_ONLINE VOTING SYSTEM
 
SRS for online examination system
SRS for online examination systemSRS for online examination system
SRS for online examination system
 

Recently uploaded

Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 

Recently uploaded (20)

Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Speed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in MinutesSpeed Wins: From Kafka to APIs in Minutes
Speed Wins: From Kafka to APIs in Minutes
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Introduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG EvaluationIntroduction to Open Source RAG and RAG Evaluation
Introduction to Open Source RAG and RAG Evaluation
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
SOQL 201 for Admins & Developers: Slice & Dice Your Org’s Data With Aggregate...
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 

KBC (Java Program written on Blue J Editor)

  • 1. package Games; import java.util.*; public class KBC { String questions[]; String options[][]; int answers[]; long money[]; int history[]; boolean lifelines[]; static int games=0; public int getRandomQuestion() { int i=(int)((Math.random()*questions.length)); return i; } public KBC() //constructor { questions=new String[] { "Who discovered Uranus? ", "According to Hindu Mythology, which of these is a brother of God Krishna ?", " In the U.S., something traditional is often said to be "as American as" what?", "The velocity of light was first measured by", "Study of life in outer space is known as", "Oncology is the study of ", "What was the name of India's first unmanned lunar spacecraft launched in October 2008?", "The credit of developing the polio vaccine goes to", "The scientist who first discovered that the earth revolves round the sun was", "Centigrade & Fahrenheit scales give same reading at", "The unit of energy in MKS system is", "Which of the following instruments is used to measure pressure of gases?", "Where is the headquarters of Microsoft located?", "'.BAT' extension refers usually to what kind of file?", "What is the highest score in international test cricket?", "What was the overall medal tally for the Indian contingent at the Glasgow Commonwealth Games 2014?", "Which of these laws helps specifically in calculating current in complex circuits with multiple cells?", "The photoelectric effect was explained effectively by Einstein on the basis of what?" }; options=new String[][] {
  • 2. {"1. Herschel ", "2. Galileo", "3. Copernicus ", "4. None of these "}, {"1. Ram ", "2. Balram ", "3. Arjun ", "4. Parsuram"}, {"1. Apple Pie ", "2. Franks and Beans ", "3. American Pie ", "4. Macaroni and cheese "}, {"1. Einstein", "2. Newton ", "3. Romer ", "4. Galileo "}, {"1. Endobiology ", "2. Exobiology", "3. Enterobiology ", "4. Neobiology "}, {"1. Birds", "2. Cancer", "3. Mammals", "4. Soil"}, {"1. Chandravahaan 1" , "2. Chandrayaan 1 ", "3. Chandravimaan 1", "4. Chadrakhoj 1"}, {"1. Jonas Salk ", "2. Alb E. Sabin ", "3. Selman Waksman ", "4. None of these "}, {"1. Newton", "2. Dalton", "3. Copernicus", "4. Einstein"}, {"1. -40 degree", "2. -32 degree", "3. -273 degree", "4. -100 degree"}, {"1. Volt", "2. Erg", "3. Ohm", "4. Joule"}, {"1. Barometer ", "2. Manometer ", "3. Saccharimeter ", "4. Lactometer "}, {"1. Santa Clara, California ", "2. Tucson, Arizona ", "3. Richmond, Virginia ", "4. Redmond, Washington"}, {"1. Compressed Archive file ", "2. System file ", "3. Audio file ", "4. Backup file "}, {"1. 333","2. 427","3. 400*","4. 512"}, {"1. 62","2. 58","3. 64","4. 65" }, {"1. Kirchoff's law","2. Coulomb's law","3. Ohm's law","4. Gauss' theorem"}, {"1. Special relativity","2. Planck's quantum theory","3. Rutherford's postulates","4. Crystal field theory"} }; answers=new int[]{1,2,1,3,2,2,2,1,3,1,4,2,4,2,3,3,1,2}; money=new long[] {1000,3000,5000,10000,25000,50000,75000,100000,250000,500000,1000000 ,2500000,5000000,7500000,10000000}; history=new int[18]; lifelines=new boolean[]{false,false,false}; } public static void main() { Scanner sc= new Scanner(System.in); int choice= 0; if(games==10) System.out.println("get a life"); if(games==0) System.out.println("fWelcome to KBCnn"); System.out.println("Your First Question is :n"); KBC k= new KBC(); //object int n=0;//no of questions completed for(int i=0;i<k.questions.length;i++) {
  • 3. int r; do { r= k.getRandomQuestion(); }while(k.history[r]==1); //loop goes till question is found which has not been asked yet System.out.println(k.questions[r]); System.out.println(k.options[r][0]); System.out.println(k.options[r][1]); System.out.println(k.options[r][2]); System.out.println(k.options[r][3]); System.out.println("Press 1,2,3 or 4nIf you do not know the answer enter 0 to use a lifeline"); choice= sc.nextInt(); while(choice>4) { System.out.println("Please enter only 0,1,2,3 or 4"); choice=sc.nextInt(); } if(choice==0) { boolean boo=true; if(k.lifelines[0]==true && k.lifelines[1]==true && k.lifelines[2]==true) boo=false; if(boo){ System.out.println("Enter 1 to use 50/50nEnter 2 to ask RajnikanthnEnter 3 to change the question"); int c=sc.nextInt()-1; while(k.lifelines[c]==true) { System.out.println("Sorry you have used this lifeline. Please choose another by entering the respective number."); c=sc.nextInt()-1; } k.lifelines[c]=true; switch(c) { case 0: int rand; do{ rand=(int)(Math.random()*4); }while(rand==(k.answers[i]-1)); if(rand<(k.answers[r]-1)) System.out.println("The remaining options aren"+k.options[r][rand]+"n"+k.options[r][(k.answers[r]-1)]); else System.out.println("The remaining options aren"+k.options[r][(k.answers[r]-1)]+"n"+k.options[r][rand]); break;
  • 4. case 1: System.out.println("Rajnikanth says the answer is "+k.answers[r]); break; case 2: k.history[r]=1; System.out.println("fYour new question is: n"); continue; } } else System.out.println("Sorry you have used all your lifelines."); System.out.println("What is your final answer?"); choice=sc.nextInt(); } n++; if(choice==k.answers[r]) { if(n==15) System.out.println("nCorrect answer nCONGRATULATIONS!!!YOU ARE A CROREPATI!nYou Won Rs."+k.money[i] +"nnThanks for playing :)"); else System.out.println("nCorrect answernYou Won Rs."+k.money[i]+"n"); } else { System.out.println("nYou LostnnGame Over !!"); if(i>=1) System.out.println("Your total prize money :Rs."+k.money[i-1]); else System.out.println("Your total prize money :Rs.0"); break; } k.history[r]=1; //indicates question is completed System.out.println("Enter any letter to continue"); String v=sc.next(); System.out.println("f");//refresh feed } System.out.println("Do you want to play again?(y/n)"); char c=sc.next().charAt(0); if(c=='y' || c=='Y') { games++; main(); } else System.out.println("Thanks for playing!"); } }