Java programming, Basic Computer Science

Write a program that lets the user play the game Rock, Paper, Scissors against the computer. The program
should 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 run of the program then a welcome message is displayed.
? A method is called to determine the computer''s choice. In the method, a random number in the range of
1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2,
then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don''t
display the computer''s choice yet).
? The user enters his or her choice of "rock", "paper", or "scissors" at the keyboard. (You can use a menu
for user input if you prefer). Remember to validate user input.
? The computer''s choice is displayed.
? A method is called to determine the winner according to the following rules:
o If one player chooses rock and the other player chooses scissors, then rock wins. Rock
smashes scissors.
o If one player chooses scissors and the other player chooses paper, then scissors wins. Scissors
cut paper.
o If one player chooses paper and the other chooses rock, then paper wins. Paper covers rock.
o If both players make the same choice, the game must be played again to determine 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.
Posted Date: 4/6/2012 12:51:38 AM | Location : United States







Related Discussions:- Java programming, Assignment Help, Ask Question on Java programming, Get Answer, Expert's Help, Java programming Discussions

Write discussion on Java programming
Your posts are moderated
Related Questions
In computing, a system call is how a program asks for a service from an operating system''s kernel. This may contain hardware related services (for example accessing the hard disk)

Consistency or data in DBMS Consistency - data in DBMS(Database) is accurate in modeling real world, follows integrity constraints User may ensure transaction consistent by itsel

how can use joystick

QUESTION (a) Convert each of the following expressions to prefix and postfix. (i) (A+B)*(C+D) (ii) A-B/(C*D^E) (^ denotes exponentiation) (b) The following algorithm c

Question 1: (a) Initially, human information processing was believed to occur in 4 distinct stages. State and describe each of those stages. (b) What are the 3 types of

WHAT DO MEAN BY ALGORITHM,HOW CAN ALGORITHM HELP TO WRITE BETTER COMPUTER PROGRAM ,WRITE AN ALGORITHM IN COMPUTER INTEREST


Ask queYou are hired as a Chief Technology Officer (CTO) of a startup company, which has two branches; one Los Angeles and one in San Francisco. The company hired employees to begi

Dictionary values encompass no limitations. They can be any random Python object, moreover standard objects or user-defined objects. Though, same is not true for the keys. There ar

Ask qu The figure below shows a rooted tree, 756_Find the height.png 1.1. Find the height/level of the tree as shown above?estion #Minimum 100 words accepted#