Ask Question, Ask an Expert

+1-415-315-9853

info@mywordsolution.com

Ask Programming Language Expert

prepare a program which permits the user to play the game Rock, Paper, Scissors against the computer. The program must work as follows:

• When the program begins, the results of the previous run of the program (ie - how many wins the user had versus how many wins the computer had) are read from a file and displayed. Note - if this is the very first execution of the program then a welcome message is shown.

• A method is called to find the computer's selection. In the method, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has selected rock. If the number is 2, then the computer has selected paper. If the number is 3, then the computer has selected scissors. (Do not display computer's selection yet).

• The user enters his or her selection of "rock", "paper", or "scissors" at the keyboard. (You could use a menu for user input if you prefer). Remember to authenticate user input.

• The computer's selection is displayed.

• A method is called to find the winner according to the following rules:

i) If one player selects rock and the other player selects scissors, then rock wins. Rock smashes scissors.

ii) If one player selects scissors and the other player selects paper, then scissors wins. Scissors cut paper.

iii) If one player selects paper and the other selects rock, then paper wins. Paper covers rock.

iv) If both players make the same selection, the game should be played again to find the winner.

• A count of the number of wins for the user and for the computer is kept.

• The user is given the opportunity to play again.

• When the user is finished playing, the count values are written to the screen and to an output file for later use.

Remember to use good programming practices!

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91803

Have any Question? 


Related Questions in Programming Language

Generate code for the given three-address statements

Generate code for the given three-address statements assuming all variables are stored in memory locations. a) x = 1 b) x = a c) x = a + 1 d) x = a + b e) The two statements x = b * c y = a + x

A certain loop requires 5 loads 7 stores and 8 arithmetic

A certain loop requires 5 loads, 7 stores, and 8 arithmetic operations. What is the minimum initiation interval for a software pipelining of this loop on a machine that executes each operation in one clock tick, and has ...

Module implementation and support1 how methods of top-down

MODULE: IMPLEMENTATION AND SUPPORT 1) How methods of top-down and bottom-up development can be applied to object-oriented software. 2) Ccommon characteristics of the prototyping, spiral, UP, and XP development approaches ...

Create a program that allows the user to enter sets of

Create a program that allows the user to enter sets of integer values, in any order.Per set of data,the program is to output the largest number. EXAMPLE 1 Given the set of supplied values:(1,-3,22,-30),the program should ...

Assignmentstep 1create a class named account with data

Assignment Step 1: Create a class named Account with data fields for an account number, payment amount and balance as well as the appropriate set and get methods. Include a constructor method that contains no arguments. ...

The colors red blueand yellow are known as the primary

The colors red blueand yellow are known as the primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color as shown here: When you mix red and blue you ge ...

Assignmentaverage salary of major league baseball

Assignment Average Salary of Major League Baseball Players Create an application that calculates the average and highest salary of Major League Baseball players in 2011 and 2012. When the user clicks a button, the applic ...

Write an mdi project that is a simple text editor allow the

Write an MDI project that is a simple text editor. Allow the user to open multiple documents, each in a separate child form. For the text editor, use one big textbox control with its multiline property set to True or a R ...

Programming project assessmentinstructions the following

Programming Project Assessment Instructions: The following programming problem can be solved by a program that uses three basic tasks-Input Data, Process Data, and Output Results. To process the data, use file, looping, ...

Derive a class programmer from employee supply a

Derive a class Programmer from Employee. Supply a constructor Programmer Exercise 1: Derive a class Programmer from Employee. Supply a constructor Programmer (string name, double salary) that calls the base-class constru ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Section onea in an atwood machine suppose two objects of

SECTION ONE (a) In an Atwood Machine, suppose two objects of unequal mass are hung vertically over a frictionless

Part 1you work in hr for a company that operates a factory

Part 1: You work in HR for a company that operates a factory manufacturing fiberglass. There are several hundred empl

Details on advanced accounting paperthis paper is intended

DETAILS ON ADVANCED ACCOUNTING PAPER This paper is intended for students to apply the theoretical knowledge around ac

Create a provider database and related reports and queries

Create a provider database and related reports and queries to capture contact information for potential PC component pro

Describe what you learned about the impact of economic

Describe what you learned about the impact of economic, social, and demographic trends affecting the US labor environmen