Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 4 Game programming Rock, Paper, ScissorsDesign a program that lets the user play the game of Rock, Paper, Scissors against thecomputer. The rules of

Task 4 Game programming Rock, Paper, ScissorsDesign a program that lets the user play the game of Rock, Paper, Scissors against thecomputer. The rules of the game are:If the user and the computer choose the same, the outcome is a draw.The program should work as follows:1. The user is asked to enter his or her choice of rock, paper, scissors or quit atthe keyboard. Any other input should be flagged as an error and the user promptedto enter another choice.2. If the user has not entered quit the computer uses the random() function to selecteither rock, paper, or scissors; else the programs ends.3. The program should then display the computers choice, the users choice, and theoutcome of the game, according to the above rules.4. Repeat at 1.For example, if the user enters rock and the computer chooses paper, the output of theprogram should be:Computer chose: Paper User chose: RockComputer wins: Paper beats RockWhen designing your solution, you will need to think carefully about what type of problem-solving strategy you will need to deploy to design the logic for your program; for example,can visualization be used (decision tables, logical rules, etc.) or can it be solved usingmathematical reasoning; this will influence how you decide to model the data? You shoulduse arrays to store the possible choices and loops to control data input validation and tofacilitate the user quitting or having another go and of course selection control structuresto model the game logic.Make a flowgorithm

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions