Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is a C++ program. CS 161 Programming Lab 6 For this exercise you will create a version of the Rock, Paper, and Scissors game

this is a C++ program. image text in transcribed
image text in transcribed
CS 161 Programming Lab 6 For this exercise you will create a version of the Rock, Paper, and Scissors game that is played against the computer. The program will use a number of functions as listed below. The computers move will be randomly generated. Problem description While this program will be an introduction to using functions, it will also be a review of data validation and loops. In addition to using functions, you will be using enums as described in Moodle. For this, as in all assignments, you are expected to follow the course programming style guidelines. Program Functionality The game must use enums to represent both the user and computer moves. Each function should have at least one comment. Constants should be used where appropriate. Display a clear set of instructions to the user ho Input R, P. or S from the user. Validate the input, if incorrect prompt the user to re-enter until correct. Either upper or lower case is ok. Get a random computer move. Display clear output describing the outcome of the game including the user's pick, the computer's pick and the winner. Ask the user if they would like to play again and repeat the entire game again as necessary. Required Functions At a minimum the program should have the following functions: displayinstructions no parameters o tells the user how to play the game no return values o O getMove O no parameters o get a move from the user and validate (R.r. P. p. Sors) o return appropriate enum (Rock, Paper, Scissors) getComp Move o no parameters o generate a random value 0, 1, or 2 o return appropriate enum (Rock, Paper, Scissors) getWinner two parameters (user move and computer move as enums) generate om Valle LUZ o return appropriate enum (Rock, Paper, Scissors) getWinner o two parameters (user move and computer move as enums) This work by Jim Bailey is licensed under a Creative Commons Attribution 4.0 International License. determine winner as described below output the results o no return values O playAgain no parameters ask the user if they want to play again o valid the result (v) o return true for y, false forn Suggestions Read the document on enums before starting Think about how to pass a parameter as an enum (hint, it is just like passing an int, but using the name of the enum). Since both the player's move and the computer's move are in enums, it is possible to use a simple series of if statements to determine the winner. 1 (player Move > computerMove) player wins else if (player Move - Rock && computer Move -- Scissors) player wins else if (player Move I computer Move) computer wins else the game is a tie

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 Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

9th Edition

0135188148, 978-0135188149, 9781642087611

More Books

Students also viewed these Databases questions

Question

Explain the chemical properties of acids with examples.

Answered: 1 week ago

Question

Write the properties of Group theory.

Answered: 1 week ago

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago