Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I just need to have a mutiplie choice answer more then 1 answer but each team ne

ID: 3577030 • Letter: I

Question

I just need to have a mutiplie choice answer more then 1 answer but each team needs to get all 3 correct in order for them to go on to the next question for team A or team B to have the next round and if they miss all 3 or , 2 out of 3 , or 1 out 3, or 0 out of 3 question they will go to the other team. Also if they miss the question and the three chances are up the go to team B and they get a chance same goes for team A. If it's already answer by the other team that 2 out of 3 ,or 1 out of 3 they get to answer 2 or 1 that the other team miss and get points.

Example what is the most common thing people forget

wallets, payment,time 3 out of 3

wallets,keys,time, 2 out of 3

keys, phone,wallets 1 out of 3

phones, keys, coupons 0 out of 3

Team B gets a chance to answer the 2 out of 3 that the team miss or, 1 out of 3 or, 0 out of 3 they miss that they miss and they gain each point they answer and it's they proceed on to the next question.

I will change questions and answers later just need help. This is the code so far and it works correctly.

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] = "First president of the United States?:";

        answers[0] ="george washington";

        questions[1] ="First food people learn to cook?:";

        answers[1] ="eggs";

        questions[2] ="Place where you see lots of joggers?:";

        answers[2] ="park";

        questions[3]="Something people save?:";

        answers[3]="money";

        questions[4]="Why a baby might be cranky?:";

        answers[4]="tired";

        questions[5]="Something small that scares childern and adults?:";

        answers[5]="spiders";

        

        

        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

import java.util.*;
class Main{
public static void main(String[] args){
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] = "First president of the United States?:";
answers[0] ="george washington";
questions[1] ="First food people learn to cook?:";
answers[1] ="eggs";
questions[2] ="Place where you see lots of joggers?:";
answers[2] ="park";
questions[3]="Something people save?:";
answers[3]="money";
questions[4]="Why a baby might be cranky?:";
answers[4]="tired";
questions[5]="Something small that scares childern and adults?:";
answers[5]="spiders";
  
  
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");
}
}
}