Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Rock, Paper, Scissors. Write a program that lets a user play Rock, Paper, Scissors against the computer. The program should ask the user to choose
Rock, Paper, Scissors. Write a program that lets a user play "Rock, Paper, Scissors" against the computer. The program should ask the user to choose one of the three choices, and then the computer randomly picks one (without knowing what the user has chosen).
Java Requirements: at least
- 1while-loop,
- 1 do-while loop,
- 1 boolean method .
- limit method length to 25 lines of code
Sample 1/0 Session Comments About I/O Session User is trapped in loop until they enter valid R,r, P, P, S, or s value. Both uppercase and lowercase input is allowed and valid. Type Rock), P(aper) or scissors): x Invalid answer. Re-type R, P or S: Y Invalid answer. Re-type R, Por S: Z Invalid answer. Re-type R, por S: r You played rock. The computer played rock. That round ended in a tie. Do you want to play another round? (Y/N) Y After user enters valid choice, A) tell them what they played. B) tell them what random choice the computer played and C) tell them who won the round. Separate each round by a blank line. Type Rock), P(aper) or scissors) : P You played paper. The computer played rock. Yippee! You won that round. Do you want to play another round? (Y/N) Y fUse a loop to allow user to control the number of rounds of the game that get played. Both uppercase and lowercase input is allowed. Type Rock), P(aper) or scissors): S You played scissors. The computer played rock. Rats! The computer won that round. Do you want to play another round? (Y/N) Y Keep track of how many rounds computer and user each win. Type R (ock), P(aper) or scissors): S You played scissors. The computer played rock. Rats! The computer won that round. Do you want to play another round? (Y/N) N Stop playing when user indicates that they want to quit. Display user and computer wins and tell who won the game. Use 's' after round" when win count # 1. You won 1 round. The computer won 2 rounds. Rats! The computer won the game
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