Question: 4. Use a while loop to complete the following code based on the description in the comment header: /** * Continually prompts that user until

4. Use a while loop to complete the following code based on the description in the comment header: /** * Continually prompts that user until they enter "yes" or "no" and then displays their response @author Hyrum D. Carroll @version 0.2 (June 25, 2020) */ import java.util.Scanner; public class User Response{ public static void main(String[] args ) { Scanner input = new Scanner(System.in); String prompt = "May I have another cookie? "; String response = ""; System.out.println( "You entered " + response ); } } 5. Rewrite the while loop in UserResponse to be a do-while loop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
