Question: JAVA QUESTION: Create a program that accepts a user input of 1 for heads, 2 for tails and any other numeric value will exit the

JAVA QUESTION:

Create a program that accepts a user input of "1" for heads, "2" for tails and any other numeric value will exit the program. "Do-while" loop must be used for this. Must use the same single variable to control the loop and also to accept the user's guesses. At the end, it mustl 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. User should also be allowed to exit without playing the game at all.

HINT: Math.random() would be very useful for this problem.

Need a java code for this and I am lost. Thanks.

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!