Question: There are 6 errors in this code, can you please help me identify them? public class FinalJeopardy { public static void main(String[] args) { Scanner

There are 6 errors in this code, can you please help me identify them?

public class FinalJeopardy { public static void main(String[] args) { Scanner input = new Scanner(System.in); int answer; //declare and initalize text responses to the player int loose = " \t\tSORRY! YOU LOSE! THANKS FOR PLAYING FINAL JEOPARDY! "; int win = " \t\tCONGRATULATIONS! YOU WIN FINAL JEOPARDY! "; String incorrectSelection = " You've enter an invalid number!! YOU LOSE! Try again next time! "; //Create (declare & initalize) questions for the game String question1, question2, question3, question4, question5, question6; question1 = "How do crickets hear?"; question2 = "What\'s the best way to stop crying while peeling onions?"; question3 = "Which animal sleeps for only five minutes a day?"; question4 = "What does ponophobia mean?"; //Start the game System.out.println(" \t\t\tWelcome to Final Jeopardy!"); System.out.println(" Rules: You must answer the question correctly to win Final Jeopardy. Good Luck! "); System.out.println(" Select one of the questions below to play Final Jeopardy: (enter 1-4) "); System.out.printf("\t1. %s ", question1); System.out.printf("\t2. %s ", question2); System.out.printf("\t3. %s ", question3); System.out.printf("\t4. %s ", question4); //Prompt the user for their selection System.out.print(" Which question would you like? "); int selection = input.nextInt(); //Validate user selection if ((selection >= 1) && (selection <= 4)) { System.out.println(incorrectSelection);

} else { switch (selection) { case 1: System.out.println(" You\'ve selected: \t" + question1); System.out.println(" Select the correct answer for Question 1: (enter 1-4)"); System.out.println("\t 1. What is through their wings? 3. What is through their belly?"); System.out.println("\t 2. What is through their knees? 4. What is through their tongues?"); System.out.print(" What is your response? "); answer = input.nextInt(); if (answer == 1 || answer == 3 || answer == 4) { System.out.println(loose); } else if (answer == 2) { System.out.println(win); break; } else System.out.println(incorrectSelection); case 2: System.out.println(" You\'ve selected: \t" + question2); System.out.println(" Select the correct answer for Question 2: (enter 1-4)"); System.out.println("\t 1. What is licking almonds? 3. What is eating cheese?"); System.out.println("\t 2. What is sucking lemons? 4. What is chewing gum?"); System.out.print(" What is your response? "); answer = input.nextInt(); if (answer == 1 || answer == 2 || answer == 3) { System.out.println(loose); } else if (answer == 4) { System.out.println(win); break; } else System.out.println(incorrectSelection); case 3: System.out.println(" You\'ve selected: \t" + question3); System.out.println(" Select the correct answer for Question 3: (enter 1-4)"); System.out.println("\t 1. What is a chameleon? 3. What is a giraffe?"); System.out.println("\t 2. What is a beaver? 4. What is a koala?"); System.out.print(" What is your response? "); answer = input.nextInt(); if (answer == 1 || answer == 2 || answer == 4) { System.out.println(loose); break; } else if (answer == 3) { System.out.println(win); break; } else System.out.println(incorrectSelection); case 4: System.out.println(" You\'ve selected: \t" + question4); System.out.println(" Select the correct answer for Question 4: (enter 1-4)"); System.out.println("\t 1. What is fear of overworking? 3. What is fear of oversleeping?"); System.out.println("\t 2. What is fear of overthing? 4. What is fear of overheating?"); System.out.print(" What is your response? "); answer = input.nextLine(); if (answer == 2 || answer == 3 || answer == 4) { System.out.println(loose); break; } else if (answer == 1) { System.out.println(win); break; } else System.out.println(incorrectSelection); }//end of switch }//end of else }//end of main }//end of class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!