Question
(JAVA)Create a program that accepts as user input 1 for heads, 2 for tails and any other numeric value to exit. You must use do
(JAVA)Create a program that accepts as user input 1 for heads, 2 for tails and any other numeric value to exit. You must use do while loop. You must use the same single variable to control your loop and also to accept the users guesses. At the end you will add up the total number of times the user guessed, the number of times the computer won and the number of times the user won. As shown in the sample output user should be allowed to exit without playing.
Hint: Math.random() method will be very useful here. You may want to use break to exit without playing.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started