Question: (Java) Modify the code below where thr usrr gets only 4 chances to make the right guess. After every attempt, thr program should display the

(Java) Modify the code below where thr usrr gets only 4 chances to make the right guess. After every attempt, thr program should display the number of chances left over to guess the right answer.
(Java) Modify the code below where thr usrr gets only 4 chances

2 4 5 6 7 8 9 1 import java.util.Scanner; 3 public class RepeatAdditionQuiz { public static void main(String[] args) { int number1 = (int) (Math.random() * 10); int number2 = (int) (Math.random() * 10); un poste a se 1/ Create a Scanner Scanner input = new Scanner(System.in); 10 + System.out.print( "What is " + number 1 + " + number2 + "?" int answer = input.nextInt(); 11 12 13 14 15 16 17 18 19 20 21 while (number1 + number2 != answer) { System.out.print("Wrong answer. Try again. What is + number1 + " + " + number2 + "? "); answer = input.nextInt(); } System.out.println("You got it!"); 22 } 23}

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!