Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Rock, Paper, Scissors game in Java. Prompt the user to enter a number of games to play. In order to eliminate the possibility

image text in transcribed
Write a "Rock, Paper, Scissors" game in Java. Prompt the user to enter a number of games to play. In order to eliminate the possibility a tie in the end, ensure that the user enters an odd number of games. The user and computer will each choose between three items: rock (defeats scissors, but loses to paper), paper (defeats rock, but loses to scissors), and scissors (defeats paper, but loses to rock.) If the user makes an invalid choice, prompt them to The computer will choose randomly which item to play. In the event that the user and computer choose the same item, there is no winner, and the round is replayed. Keep track of the number of wins each by the user and by the computer After the game has ended, print the number of wins by the user and by the computer, and declare a winner. Sample session: Welcome to Rock, Paper, Scissors! Please enter the number of rounds you would like to play: 2 Sorry, you need to enter an odd number. Please: 4 Sorry, you need to enter an odd number. Please: 3 Rock, Paper, or Scissors?: Monkey Sorry, "Monkey" is not a valid entry. Rock, Paper, or Scissors?: Rock Computer chooses Paper. You lose. Rock, Paper, or Scissors?: Rock Computer chooses Rock. It's a tie. Rock, paper, or Scissors?: Paper Computer chooses Rock. You win! Rock, Paper or Scissors?: Rock Computer chooses Scissors. You win! User wins: 2 Computed wins: 1 User Wins the game

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

The Temple Of Django Database Performance

Authors: Andrew Brookins

1st Edition

1734303700, 978-1734303704

More Books

Students also viewed these Databases questions

Question

Understand how customers respond to effective service recovery.

Answered: 1 week ago