Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 2 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 27 Jul 2017 My Price 14.00

Rock, Paper, Scissors Game

Rock, Paper, Scissors Game

Design a program using Java language, that lets the user play the game of Rock, Paper, and Scissors against the computer. The program should work as follows:

(1) When the program begins, 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. (DonA????1t display the computerA????1s choice yet.)

(2) The user enters his or her choice of A????1rock,A????1 A????1paper,A????1 or A????1scissorsA????1 at the keyboard.

(3) The computerA????1s choice is displayed.

(4) The program should display a message indicating whether the user or the computer was the winner. A winner is selected according to the following rules:

? If one player chooses rock and the other player chooses scissors, then rock wins. (The rock smashes the scissors.)

? If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors cut paper.)

? If one player chooses paper and the other player chooses rock, then paper wins. (Paper wraps rock.)

? If both players make the same choice, the game must be played again to determine the winner.


Here is a pseudo-code to follow:

//Declare the variable

Declare Integer num

Declare String comp, plyr

//Iterate a loop if both the playerA????1s choice is same Do

//Get a random number from 1 through 3 and put it in num

            Set num = random(1, 3)

//Initialize comp based on the random value of num

            If num == 1 Then

                        Set comp = A????1rockA????1

            Else If num == 2 Then

                        Set comp = A????1paperA????1

            Else If num == 3 Then

                        Set comp = A????1scissorsA????1

            End If

//Read the playerA????1s choice and put it in plyr

            Display A????1Please enter your choice.A????1

            Input plyr

//Display computerA????1s choice

            Display A????1Computer has chosen: A????1, comp

//Compare with three possible choices of comp

//that of three possible choices of plyr, and provide

//a message accordingly

If comp == A????1rockA????1 Then

            If plyr == A????1rockA????1 Then

                        Display A????1Play again.A????1

            Else If plyr == A????1paperA????1 Then

                        Display A????1You won.A????1

            Else If plyr == A????1scissorsA????1 Then

                        Display A????1Computer won.A????1

End IF

Else If comp == A????1paperA????1 Then

            If plyr == A????1rockA????1 Then

                        Display A????1Computer won.A????1

            Else If plyr == A????1paperA????1 Then

                        Display A????1Play again.A????1

            Else If plyr = = A????1scissorsA????1 Then

                        Display A????1You won.A????1

End If

Else If comp == A????1scissorsA????1 Then

            If plyr == A????1rockA????1 Then

                        Display A????1You won.A????1

            Else If plyr == A????1paperA????1 Then

                        Display A????1Computer won.A????1

            Else If plyr = = A????1scissorsA????1 Then

                        Display A????1Play again.A????1

            End If

End If

//The loop iterates until both playerA????1s choice is different

while comp == plyr

Answers

(5)
Status NEW Posted 27 Jul 2017 10:07 AM My Price 14.00

Hel-----------lo -----------Sir-----------/Ma-----------dam----------- Â-----------  -----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------sol-----------uti-----------on.-----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- ca-----------tch-----------

Not Rated(0)