Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions