Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions