Question: import java.util.Scanner; import java.util.Random; public class Guess { public static void main(String[] args) { int numToGuess; //Number the user tries to guess int guess; //The

import java.util.Scanner; import java.util.Random;

public class Guess { public static void main(String[] args) { int numToGuess; //Number the user tries to guess int guess; //The user's guess

Random generator = new Random();

//randomly generate the number to guess

//print message asking user to enter a guess

//read in guess while ( ) //keep going as long as the guess is wrong { //print message saying guess is wrong //get another guess from the user }

//print message saying guess is right } }

File Guess.java(given above) contains the skeleton for a program that uses a while loop to play a guessing game. (This problem is described in the previous lab exercise.) Revise this program so that it uses a do ... while loop rather than a while loop. The general outline using a do... while loop is as follows: ^^^^^^^^^^^^^^^^^^^^^^^

// set up (initializations of the counting variables) ....

do

{

// read in a guess ...

// check the guess and print appropriate messages

...

}

while ( condition );

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!