Question
Remember the childhood game Rock, Paper, Scissors? It is a two-player game in which each person simultaneously chooses either rock, paper, or scissors. The rules
Remember the childhood game Rock, Paper, Scissors? It is a two-player game in which each person simultaneously chooses either rock, paper, or scissors. The rules are:
- Rock beats scissors but loses to paper
- Paper beats rock but loses to scissors
- Scissors beats paper but loses to rock
Write the code to create the game. Name your class "RockPaperScissorsYourLastName.java". Prompt player 1 and player 2 to each enter a string: rock, paper, or scissors. Pass those values to a method you create to determine the winner and return a winner.
Plan your code so that if they input with capitals, the game will still play.
Use a nested if statement to determine the winner (not AND or OR statements in the condition of your if statements). Set the winner in your if statement. DO NOT PRINT THE WINNER FROM THIS IF STATEMENT. You should use this if statement just SET the winner. Keep your view separate from the logic of this if statement. Print the winner from the main method.
Use efficient if statements. Remember: you don't have to check every possible situation.
Write a test to test your method
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