Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This week, you will be writing a Java application program that plays the game of Paper, Rock, Scissors with the user. Your program will begin

This week, you will be writing a Java application program that plays the game of "Paper, Rock, Scissors" with the user.

Your program will begin by displaying the title of the game, and asking the user if instructions are needed. Next, the user will be asked to type in their choice. You should expect the user to type the word "paper", the word "rock", or the word "scissors".

After the user enters a choice, the computer will randomly pick one of the three words.

Next, display both the player's choice and the computer's choice to the screen, along with a message stating "I WIN" or "YOU WIN" or "IT'S A TIE".

Finally, the user will be asked if he/she wants to play again. If the user answers "Y" or "y", then the game will start again, by asking the user for another choice.

If the user does not want to play again, you some statistics about the game play will be displayed on the screen:

assignment part 1

There is already an existing class called PRS, with an existing main method.

Inside the PRS class, create a void method called instructions. The purpose of this method is to print the instructions on the screen to the user.

Do not change any of the existing code in the main method, and do not add code to the main method.

The following are the instructions that this method should print to the screen. Make sure that your formatting, and blank lines are exactly as shown below:

This is the popular game of paper, rock, scissors. Enter your choice by typing the word "paper", the word "rock" or the word "scissors". The computer will also make a choice from the three options. After you have entered your choice, the winner of the game will be determined according to the following rules: Paper wraps rock (paper wins) Rock breaks scissors (rock wins) Scissors cuts paper (scissors wins) If both you and the computer enter the same choice, then the game is tied.

assignment part 2

There is already an existing class called PRS, with no main method.

Inside the PRS class, create a method called analyzeRound. The purpose of this method is to analyze the user's choice and the computer's choice and determine who won.

The method should take two String parameters, in this order: the user's choice and the computer's choice. Both the user's choice and the computer's choice values are expected to be the word "paper", the word "rock", or the word "scissors".

The method should return a single integer as follows: Return the integer 1 if the player wins Return the integer 2 if the computer wins Return the number 3 if it is a tie

This method SHOULD NOT print the outcome on the screen.

Do not write or add a main method to this class. At this point, you are only creating the analyzeRound method.

Testing:

The name of each test will tell you what parameter values are being passed to your method.

If your method is not written correctly (i.e. does not have the correct parameters or return value data types), then the tests will fail and will show nothing.

If your code does not compile, then the tests will fail and will show nothing.

If your method is written correctly, but returns the wrong value, then the test will show failed, and will tell you what value the method should be returning.

If your method is written correctly and returns the correct value, then the test will pass

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

Relational Database And SQL

Authors: Lucy Scott

3rd Edition

1087899699, 978-1087899695

Students also viewed these Databases questions

Question

Appreciate the advantages of arbitration

Answered: 1 week ago

Question

Differentiate between hard and soft measures of service quality.

Answered: 1 week ago

Question

Be familiar with the different perspectives of service quality.

Answered: 1 week ago

Question

Describe key customer feedback collection tools.

Answered: 1 week ago