Question: This is Java Program. Thank you! Create a combat simulator where the player and computer each start with 10 lives. The player and computer will

This is Java Program. Thank you!

This is Java Program. Thank you! Create a combat simulator where the

Create a combat simulator where the player and computer each start with 10 lives. The player and computer will alternate attacks that do damage randomly from 1 to 5 points. Alternate attacks until one of the competitors reaches zero (If one number goes into the negatives that is okay). Display the winner. Hint: - Use a while of do while loop to keep repeating attacks - Use ThreadLocalRandom to get a random number between 1 and 5 - Use an if statement to determine the winner Player : 10 | Computer: 10 Player does 3 points of damage Player: 10 Computer: 7 Computer does 3 points of damage Player: 7 | Computer: 7 Player does 1 points of damage Player: 7 Computer: 6 Computer does 3 points of damage Player: 4 | Computer: 6 Player does 2 points of damage Player: 4 | Computer: 4 Computer does 4 points of damage Player: 0 | Computer: 4 Computer Wins

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!