Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction This project requires students to create a design for a Rock, Paper, Scissors, and Saw game and then implement it in Java. This Software

Introduction

This project requires students to create a design for a Rock, Paper, Scissors, and Saw game and then implement it in Java. This Software Requirements Specification (SRS) document will outline all the features required of the system.

1.1 Purpose

The purpose of this simple SRS is to provide all the basic requirements necessary to complete Software Design Specification (SDS) for Project 4 and to implement the system.

1.2 Scope

The software to be created will be a stand-alone PC representation of the hand game called Rock, Paper, Scissors, and Saw, implemented with OO approach using Java. It will have two human players and a computer acting as the third player.

2. General Description

When user(s) starts the program, he will be prompted for the names of the two human players. These values will be used for all prompts and statistics in the program.

Then there will be a menu with the following selections: 1. Play game, 2. Show game rules, 3. Show statistics, and 4. Exit in that order. Rules selection will provide rules of the game, statistics will show the accumulative wins, loses, and ties per each player (both rounds and games), and exit will close the program.

When play game is selected, each player will be able to select his weapon (rock, paper, scissors, or saw) and computer will make its choice. Each of the players will be playing against the computer. A game will consist of 3 rounds. After each round either a player or computer will be the winner of the round and after 3 rounds, again either computer or player will be the winner of the game. User(s) will be able to run multiple games and their wins/loses/ties will be displayed in the statistics option along with the overall human winner.

2. 1 Product Functions/Requirements Flow

Below are all the basic requirements the system must satisfy

2.1.1 Initial screen

2.1.1.1 Description

When program starts, it needs to prompt user for the names of the two human players.

2.1.1.2 Stimulus/Response Sequences

User starts the program, prompt is displayed and user has to respond before program goes on.

2.1.1.3 Functional Requirements

[R1.1] User must be prompted with the following message What is the name of the first player? and then after correct response is supplies, What is the name of the second player?

[R1.2] User must type a string no longer than 20 characters and no less than 5 characters. For invalid input, program must issue an error message and re-prompt.

[R1.3] Second player name must be different from first player. For invalid input, program must issue an error message and re-prompt for the second players name.

[R1.4] Program will use the saved input value for prompting players for their weapons, issue messages, and to display statistics for all players.

[R1.5] Once correct response is given, program will display the menu.

2.1.2 Menu

2.1.2.1 Description

Program needs to display a menu with 4 selections: 1. Play game, 2. Show game rules, 3. Show statistics, and 4. Exit in that order.

2.1.2.2 Stimulus/Response Sequences

User correctly provides players names, menu is displayed, and user may select one of the 4 options.

2.1.2.3 Functional Requirements

[R2.1] Menu must be displayed correctly with provided naming of menu choices and in correct order and user can select one of the options by typing the corresponding number and pressing return.

[R2.2] Show rules selection must display all the rules for the game (see Rules requirement below for details) and how users can win. User will be able to return to the menu.

[R2.3] Statistics selection will display the accumulative statistics per round and game for each player. User will be able to return to the menu.

[R2.4] Exit selection must end the program with a Goodbye message.

[R2.5] Play selection will allow the user to play the game. Once game is completed, user will be able to return to the menu.

[R2.6] If user makes an invalid menu selection, error message will be displayed and user will be prompted again.

2.1.3 Statistics

2.1.3.1 Description

Program needs to keep track of the statistics.

2.1.3.2 Stimulus/Response Sequences

User selects 3. Show statistics from the menu

2.1.3.3 Functional Requirements

[R3.1] Statistics selection will display the number of rounds each player won, lost, or had a tie against the computer, each players stats on new line

[R3.2] Statistics selection will display the number of games each player won, lost, or had a tie against the computer, each players stats on new line (winner of the game is one who won most rounds out of the 3 rounds and lost the least rounds)

[R3.3] Stats for each player will have his name and rounds and games stats will be shown on same line

[R3.4] Statistics selection will display the overall human winner based on the most won games and lost least games against the computer compared to other human players. If both players had same number of wins and losses for games, a tie will be announced for the overall winner

[R3.5] The statistics are accumulative until users exit the program.

[R3.6] On start of the program, all statistics are 0.

2.1.4 Play game

2.1.4.1 Description

Players will be allowed to select their weapons and after 3 rounds, the winners will be shown.

2.1.4.2 Stimulus/Response Sequences

Play game is selected from the menu.

2.1.4.3 Functional Requirements

[R4.1] When game starts, each Player gets prompted for his selection of Rock, Paper, Scissors, and Saw. The prompt must use the players name.

[R4.2] Computer makes its random selection to be used against each player (same selection will be used against both human players)

[R4.3] For each player, program displays that players selection, computers selection and who won that round (computer or player)

[R4.4] Next round repeats the prompting and announcement of the round winners. This is repeated for a total of 3 rounds.

[R4.5] Once all 3 rounds are completed winners of the game are announced for each player. Just like rounds, each player is playing against the computer and so the winner of the game is either the player or the computer.

[R4.6] The winner of the game is one who won most rounds. The program must account for ties. For example, if a player won 2 rounds and lost 1 round, then he won the game against the computer. If the player won 1 round, lost 1 round, and tied 1 round then he tied the game against the computer.

[R4.7] After game winners are announced, user is able to go back to menu where they can again select one of the options.

[R4.8] Users can play as many games as they want

2.1.5 Rules

2.1.5.1 Description

Rules of the game will be displayed and used to determine the winner.

2.1.5.2 Stimulus/Response Sequences

User selects 2. Show game rules and is given the rules or program need to determine a winner.

2.1.5.3 Functional Requirements

[R5.1] Winner of the round will be determined as follow:

Rock breaks scissors and Saw therefore rock wins over scissors and saw. Rock loses against paper.

Scissors cut paper therefore scissors win over paper. Scissors lose against rock and Saw.

Paper covers rock therefore paper wins over rock. Paper loses against scissors and saw

Saw cuts through scissors and paper therefore saw wins over scissors and paper. Saw loses against rock.

If player and computer make the same selection, there is a tie

[R5.2] Winner of the game against the computer is one who won more rounds (must account for ties)

[R5.3] Overall human winner is based on the greater number of won games against the computer and least games lost (must account for tie between human players)

[R5.4] The above rules will be displayed to the user

2.2 Classes / Objects

2.2.1 The software must have four classes as follow:

Player stores all information related to a single player (whether human or computer)

Must have an attribute of type Statistics to store statistics data for the player

Must have attribute to store players name

Statistics stores and displays all stats information for a single player (rounds and games).

Game contains all the logic to play a game consisting of 3 rounds

Must have a method to display rules for winning and basic instructions how game is played (based on the requirements given)

Must have all the logic for playing automatically 3 rounds and announce winners of each round and winners of each game (based on the requirements given)

GameDriver includes main() method that creates instances of all the other classes, prompts the user and then calls Games class methods to run the game.

Must prompt user for names of human players

Must display the menu and allow users to select from the menu.

Must create instances of the Players and initialize them

Must store Players in a list or array

Must create an instance of Game and start the game when user selects that option

2.2.2 Each class must be in a separate file. Files have to be named same as the class name (e.g. Player.java).

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

Essential SQLAlchemy Mapping Python To Databases

Authors: Myers, Jason Myers

2nd Edition

1491916567, 9781491916568

More Books

Students also viewed these Databases questions