Need help making this a mutil answer, need all three to be answers and the team
ID: 3579203 • Letter: N
Question
Need help making this a mutil answer, need all three to be answers and the team need to answer all three to move on to the next question
Scanner sc = new Scanner(System.in);
int TeamAScore = 0, TeamBScore = 0;
int currentQuestionTeam = 0;
String[] questions = new String[6];
String[] answers = new String[6];
System.out.println("Welcome Team A and Team B I'm your host Steve Harvey");
System.out.println("I will be asking you some question and you will receive 1 point for each answer ");
System.out.println("you must type your answer in lower case form other wise you won't get the answer");
System.out.println("right. So lets get started!");
questions[0] = "Name types of beverages people drink:";
answers[0] ="Soda","Fruit juice","Tea";
questions[1] ="Name something people eat at breakfeast:";
answers[1] ="eggs","toast","bacon ";
questions[2] ="Place where you see lots of joggers?:";
answers[2] ="park","mountain","neighborhood";
questions[3]="Something people save?:";
answers[3]="money", "photos","coupons";
questions[4]="Why a baby might be cranky?:";
answers[4]="tired","hunger","burp";
questions[5]="Something small that scares childern and adults?:";
answers[5]="spiders","mice","rats";
for(int i=0;i< 6;i++){
for(int k=1;k<=3;k++){
if(currentQuestionTeam == 0){
System.out.println("Attempt "+k+" : Question to Team A: ");
System.out.println(questions[i]);
String ans = sc.nextLine();
if(ans.equals(answers[i])){
System.out.println("correct");
if(currentQuestionTeam == 0){
TeamAScore++;
currentQuestionTeam = 1;
i++;
break;
}else{
TeamBScore++;
currentQuestionTeam = 0;
i++;
break;
}
}
}else{
System.out.println("Attempt "+k+" : Question to Team B: ");
System.out.println(questions[i]);
String ans = sc.nextLine();
if(ans.equals(answers[i])){
System.out.println("correct");
if(currentQuestionTeam == 0){
TeamAScore++;
currentQuestionTeam = 1;
i++;
break;
}else{
TeamBScore++;
currentQuestionTeam = 0;
i++;
break;
}
}
}
}
currentQuestionTeam = 1;
for(int k=1;k<=3;k++){
if(currentQuestionTeam == 0){
System.out.println("Attempt "+k+" : Question to Team A: ");
System.out.println(questions[i]);
String ans = sc.nextLine();
if(ans.equals(answers[i])){
System.out.println("correct");
if(currentQuestionTeam == 0){
TeamAScore++;
currentQuestionTeam = 1;
i++;
break;
}
else
{
TeamBScore++;
currentQuestionTeam = 0;
i++;
break;
}
}
}
else
{
System.out.println("Attempt "+k+" : Question to Team B: ");
System.out.println(questions[i]);
String ans = sc.nextLine();
if(ans.equals(answers[i]))
{
System.out.println("correct");
if(currentQuestionTeam == 0)
{
TeamAScore++;
currentQuestionTeam = 1;
i++;
break;
}
else
{
TeamBScore++;
currentQuestionTeam = 0;
i++;
break;
}
}
}
}
currentQuestionTeam = 0;
}
System.out.println("Team A score: "+TeamAScore);
System.out.println("Team B score: "+TeamBScore);
if(TeamAScore > TeamBScore){
System.out.println("Team A wins");
}else if(TeamAScore < TeamBScore){
System.out.println("Team B wins");
}else{
System.out.println("Both teams same score");
}
}
}
Explanation / Answer
Scanner sc = new Scanner(System.in);
int TeamAScore = zero, TeamBScore = 0;
int currentQuestionTeam = 0;
String[] queries = new String[6];
String[] answers = new String[6];
System.out.println("Welcome Team A and Team B i am your host Steve Harvey");
System.out.println("I are asking you some question and you'll receive one purpose for every answer ");
System.out.println("you should sort your answer in character type alternative wise you will not get the answer");
System.out.println("right. therefore lets get started!");
questions[0] = "Name forms of beverages folks drink:";
answers[0] ="Soda","Fruit juice","Tea";
questions[1] ="Name one thing folks gnaw at breakfeast:";
answers[1] ="eggs","toast","bacon ";
questions[2] ="Place wherever you see scores of joggers?:";
answers[2] ="park","mountain","neighborhood";
questions[3]="Something folks save?:";
answers[3]="money", "photos","coupons";
questions[4]="Why a baby may well be cranky?:";
answers[4]="tired","hunger","burp";
questions[5]="Something tiny that scares childern and adults?:";
answers[5]="spiders","mice","rats";
for(int i=0;i< 6;i++)
}
}else
}
}
}
currentQuestionTeam = 1;
for(int k=1;k<=3;k++)
}
}
else
}
}
}
currentQuestionTeam = 0;
}
System.out.println("Team A score: "+TeamAScore);
System.out.println("Team B score: "+TeamBScore);
if(TeamAScore > TeamBScore)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.