Question: JAVA Code Write the code to create the game. Name your class RockPaperScissorsYourLastName.java. Prompt player 1 and player 2 to each enter a string: rock,

JAVA Code

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 to 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.

If you're familiar with the Big Bang Theory, then you're familiar with Rock, Paper, Scissors, Lizard, Spock.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!