Question: JAVA project Rock Paper Scissors In this project you will complete the implementation of a Java program that plays the game of Rock, Paper, Scissors.

JAVA project Rock Paper Scissors

In this project you will complete the implementation of a Java program that plays the game of Rock, Paper, Scissors. The human user of the program plays against the computer. The program uses a random number generator for the computers choices. The program decides on the winner of each round (or tie) and keeps track of the human and computers scores as well as the number of rounds played. The game (https://en.wikipedia.org/wiki/Rock-paper-scissors) is played as follows: There can be any number of rounds played. For each round, each player chooses Rock or Paper or Scissors. The two choices are compared and scored according to these rules:

Rock beats ("crushes") Scissors.

Paper beats ("covers") Rock.

Scissors beats ("cuts") Paper.

When two players make the same choice it is a tie. Another round may be played.

In our version, the winner of a round is awarded one point, the looser zero points. Ties result in no points awarded to either player. The total scores of the human and computer as well as the number of rounds played is recorded.

Objectives:

Work with a multiple-class program.

Gain experience implementing "stub" code

Work with a seeded random number generator.

Write helper methods to support a somewhat complex operation.

Be able to write a class definition that works according to a specification.

Gain experience developing code in an incremental fashion.

Examples and Resources:

The following is an example of the player interaction with a completed game:

 JAVA project Rock Paper Scissors In this project you will complete

You are given two Java source files: GameMain.java and RPSGame.java. RPSGame starter code The GameMain.java file is given to you. Do not modify it. You will work in and submit the RPSGame.java file only. The RPSGame.java file contains "stub" or "skeleton" code. This code contains the "bare bones" of the program; the variable declarations and method headers with the minimum body code so that the class compiles. Your job is to implement each method (including the constructor) in the RPSGame.java file so that the program works as specified. For example, this is the skeleton of one method:

 public boolean isValidInput(String inputStr) { return false; } 

The "return false;" statement is there so the method will compile, but you will replace that with code that implements the functionality that method should provide, according to the comments above the method.

Requirements:

You must submit a class definition named RPSGame exactly. You will receive zero points if you do not meet this requirement. Since you will be filling in the skeleton code file, this is already done, so it should not be an issue.

Your code must compile to receive more than zero points.

You may not modify the method headers and existing variable declarations in the skeleton code.

Your getScoreReportStr String must match the example exactly.

Your code must be your own work. Any code that is copied from another student or outside source is considered plagiarism and if detected you will receive zero points and other action will be taken (see syllabus for details).

If a method comment states that a method must be called from another method, then you must have that call in your code.

To receive full credit your code must correctly implement the rules of the game as specified.

Development suggestions:

Do not write all of the code first and then try to compile and debug it.

Use a pencil and paper to plan your algorithm- how the rules of the game will be implemented.

Write the simpler methods first and test them independently- use a simple "Tester" class or debugger to do this. The more complex methods call the simpler methods.

Compile after you make any code changes.

Use the seeded random number generator. Notice that the computer choices will always be the same for the same seed value. You can use this to help test and debug.

Get started on this early. You do not want to do this project the night before it is due.

You may not delete any methods or variables from the code, but you may add variables and private methods if you wish. Note that extra variables and private methods are not required to make the program run correctly, but you may add them.

GAME MAIN CODE

the implementation of a Java program that plays the game of Rock,

RPSGame

Paper, Scissors. The human user of the program plays against the computer.

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!