Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Your finished code is worth 15 points. Upload the program & test .java files here.

Extra credit opportunity: If you're familiar with the Big Bang Theory, then you're familiar with Rock, Paper, Scissors, Lizard, Spock. Make sure you add the tests to your testing file as well!

Here is the image to incorporate for extra credit:

image text in transcribed

Its Simple spock smashes scissors scissors cuts paper scissors decapitates lizard paper disproves spock spock vaporizes rock rock crushes scissors paper covers rock lizard poisons spock lizard eats paper rock crushes lizard

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

Students also viewed these Databases questions

Question

What is physics and how does it apply in daily life?

Answered: 1 week ago

Question

What is the relation of physical mathematics with examples?

Answered: 1 week ago