Question
For ITP 120 Programming Assignment 1, you are going to code a Rock Paper and Scissors game.In this game, you play the role of the
For ITP 120 Programming Assignment 1, you are going to code a Rock Paper and Scissors game.In this game, you play the role of the other playerby entering in a choice for them R for Rock or P for Paper orS for Scissors and the Random number generator in Java chooses for you. Thats theonly fair way we can do it.Here are the rules and requirements. You begin by asking a player this following: Please enter Play if you want to play the game or anything else to Stop.This starts a sentinel value loop that will beused to controlthe program until the user chooses not to play another game. If the user enters play (no matter what case they use, uppercase, lowercase, a mix of eachwhen entering Play, make sure that the game starts). Once the game starts, enter thefollowing information to the player to let them choose Rfor Rock, or Pfor Paper, or S for Scissors. (Notice that you need to keep track of how many games are played...Game 1, Game 2, Game 3, etc.)Game 1 Rock, Paper, Scissors -Play!Choose your weapon [R]ock], [P]aper, or [S]cissors:Each time they choose to play the game, validate their choice of weaponwith a while loop to make sure that it is one of the following letters: R,P,S.Then, display their inputwith a messageas follows where you replace the _ with the letter they have chosen:You chose: _ Then, usethe Random number generator to generate 3 possible numbers from 0 to 2that represent the choice you are making. Based on the number generated, you will assign a letter that represents your choice as follows. This will require adecision structure (meaning switch, or sequential ifs, or if else if).If the random generator generates a 0, you have chosen R for Rock.If the random generator generates a 1, you have chosen P for Paper.If the random generator generates a 2, you have chosen S for Scissors.Then, display your choice with a message as followswhere you replace the _ with the letter you are playing.I chose: _Then, you will need another decision structure to determine who wins the game and displaysa message and keeps track of tie games, how many games the user wins, and how many games you win. Remember the randomgenerator is making your choices for youand you play the role of the other player by entering in their choices.Here are the rules:If there is a tie, you display the following message Tie! Then add 1 to a counter that is keeping track of the number of ties.
If the user chooses P and your choice is S, you display the following message Scissors beats paper, a win for me! Then add 1 to a counter that is keeping track of your wins.If the user chooses Sand your choice is R,you display the following message Rock beats scissors, a win for me!Then add 1 to a counter that is keeping track of your wins.If the user chooses Rand your choice is P,you display the following message Paper beats rock! a win for me!Then add 1 to a counter that is keeping track of your wins.If the user chooses Sand your choice is P,you display the following message Scissors beats paper, a win for you! Then add 1 to a counter that is keeping track of theirwins.If the user choosesRand your choice is S,you display the following message Rock beats scissors, a win for you! Then add 1 to a counter that is keeping track of theirwins.If the user choosesPand your choice is R,you display the following message Paper beats rock! a win for you! Then add 1 to a counter that is keeping track of theirwins.Then ask the user if they want to play the game as follows: Please enter Play if you want to play the gameagainor anything else to Stop.After the user chooses to stop the game, you want to display a report that shows who won the most gameswhere the _ will be replaced by each of your scores respectively.~~~Final Score~~~Your Score My Score__Then, you will need an if statement to compare thenumber of games they wonto the number of games you won and display the following:If they won more games thanyou did, display the following message that shows how many games they outscored you byas represented by the _. Please replace the _ with the number of games that they outscored you.Congratulations! You outplayed me by _games!If youwon more games thantheydid, display the following message that shows how many games yououtscored thembyas represented by the _. Please replace the _ with the number of games that you outscored them.You're a great opponent! I beat you by only _games.If the number of games that you and the other player played was a tie,then display thefollowing message and the number of tie games.Replace the _ with the number of tie games for each of you.We're all tied upwith _ games apiece. Let's play again soon.");Below is the output for the program when running with test datawhere you won. Input data is shown in red.
Please enter Play if you want to play the game or anything else to Stop.playGame 1 Rock, Paper, Scissors -Play!Choose your weapon [R]ock], [P]aper, or [S]cissors: rYou chose: RI chose: RTie! Please enter Play if you want to play the game or anything else to Stop.playGame 2 Rock, Paper, Scissors -Play!Choose your weapon [R]ock], [P]aper, or [S]cissors: pYou chose: PI chose: SScissors beats paper, a win for me! Please enter Play if you want to play the game or anything else to Stop.playGame 3 Rock, Paper, Scissors -Play!Choose your weapon [R]ock], [P]aper, or [S]cissors: sYou chose: SI chose: RRock beats scissors, a win for me! Please enter Play if you want to play the game or anything else to Stop.PlayGame 4 Rock, Paper, Scissors -Play!Choose your weapon [R]ock], [P]aper, or [S]cissors: sYou chose: SI chose: RRock beats scissors, a win for me! Please enter Play if you want to play the game or anything
else to Stop.playGame 5 Rock, Paper, Scissors -Play!Choose your weapon [R]ock], [P]aper, or [S]cissors: pYou chose: PI chose: RPaper beats rock! a win for you! Please enter Play if you want to play the game or anything else to Stop.playGame 6 Rock, Paper, Scissors -Play!Choose your weapon [R]ock], [P]aper, or [S]cissors: rYou chose: RI chose: SRock beats scissors, a win for you! Please enter Play if you want to play the game or anything else to Stop.stop~~~Final Score~~~Your Score My Score2 3You're a great opponent! I beat you by only 1 game(s).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started