Question: You are required to create a game in Java that plays Rockpaperscissors game. The user bets 10 dollars on the Rockpaperscissors game. The payouts are

You are required to create a game in Java that plays Rockpaperscissors game. The user bets 10 dollars on the Rockpaperscissors game. The payouts are defined as follows:

If the user wins by Rock, the user gets 2x the bet.

If the user wins by Paper or Scissors, the user gets 1x the bet.

Otherwise, the user loses the bet.

The game continues until the user is out of money or the user chooses to quit the game by entering 0. Suppose the user initially has 10 dollars.

Create a single-dimensional array with 2 cells to save the users choice and the computers choice for each game.

Sample inputs/outputs

You have 10 dollars.

Enter 1 for Rock, 2 for Paper, 3 for Scissors, or 0 if you want to exit.

1

Results: Rock (you) : Scissors (computer)

You won 20 dollars! You now have 30 dollars.

Enter 1 for Rock, 2 for Paper, 3 for Scissors, or 0 if you want to exit.

1

Results: Rock (you) : Rock (computer)

You lost 10 dollars. You now have 20 dollars.

Enter 1 for Rock, 2 for Paper, 3 for Scissors, or 0 if you want to exit.

3

Results: Scissors (you) : Rock (computer)

You lost 10 dollars. You now have 10 dollars.

Enter 1 for Rock, 2 for Paper, 3 for Scissors, or 0 if you want to exit.

2

Results: Paper (you) : Paper (computer)

You ran out of money. Thanks for playing.

-

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!