Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA You are required to create a game that plays Rockpaperscissors game. The user bets 10 dollars on the Rockpaperscissors game. The payouts are defined

JAVA

You are required to create a game 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

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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Write a note on job design.

Answered: 1 week ago

Question

Compute the derivative of f(x)cos(-4/5x)

Answered: 1 week ago

Question

Discuss the process involved in selection.

Answered: 1 week ago

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago