22.1 LAB*: Program: Rock paper scissors Program Specifications Write a program to play an automated game of Rock, Paper,

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

22.1 LAB*: Program: Rock paper scissors Program Specifications Write a program to play an automated game of Rock, Paper,

Post by answerhappygod »

22 1 Lab Program Rock Paper Scissors Program Specifications Write A Program To Play An Automated Game Of Rock Paper 1
22 1 Lab Program Rock Paper Scissors Program Specifications Write A Program To Play An Automated Game Of Rock Paper 1 (68.13 KiB) Viewed 17 times
22.1 LAB*: Program: Rock paper scissors Program Specifications Write a program to play an automated game of Rock, Paper, Scissors. Two players make one of three hand signals at the same time. Hand signals represent a rock, a piece of paper, or a pair of scissors. Each combination results in a win for one of the players. Rock crushes scissors, paper covers rock, and scissors cut paper. A tie occurs if both players make the same signal. Use a random number generator of 0, 1, or 2 to represent the three signals. Note: this program is designed for incremental development. Complete each step and submit for grading before starting the next step. Only a portion of tests pass after each step but confirm progress. Step O. Read starter template and do not change the provided code. Integer constants are defined for ROCK, PAPER, and SCISSORS. A Random object is created and a seed is read from input and passed to the Random object. This supports automated testing and creates predictable results that would otherwise be random. Step 1 (2 pts). Read two player names from input (String). Read number of rounds from input. Continue reading number of rounds if value is below one and provide an error message. Output player names and number of rounds. Submit for grading to confirm 2 tests pass. Ex: If input is: 3 Anna Bert -3 -4 4 Sample output is: Rounds must be > 0 Rounds must be > 0 Anna vs Bert for 4 rounds Step 2 (2 pts). Generate random values (0-2) for player 1 followed by player 2 by calling rand.nextInt (3). Continue to generate random values for both players until both values do not match. Output "Tie" when the values match. Submit for grading to confirm 3 tests pass. Ex: If input is: 9 Anna Bert 1 Sample output is: Anna vs Bert for 1 rounds Tie Tie
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply