Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Don't copy. 

 

Scissor, rock, paper
Write a program called GameSRP.java that plays the popular scissor-rock-paper game where a scissor can cut paper, a rock kan nock a scissor and a paper can wrap a
rock. The program asks the user for one of the options (1 for scissor, 2 for rock or 3 for paper) and then randomly picks one of them for the computer. It then presents if
you or the computer won, or if it was a draw. If the user enters 0 the program will end and display the total score (number of wins for you and the computer and the draws).
Here is a sample run:
Scissor (1), rock (2), paper (3) or 0 to quit: 1
You lost, computer had rock!
Scissor (1), rock (2), paper (3) or 0 to quit: 2
It's a draw!
Scissor (1), rock (2), paper (3) or 0 to quit: 3
You won, computer had rock!
Scissor (1), rock (2), paper (3) or 0 to quit: 1
You lost, computer had rock!
Scissor (1), rock (2), paper (3) or 0 to quit: 2
It's a draw!
Scissor (1), rock (2), paper (3) or 0 to quit: 3
You won, computer had rock!
Scissor (1), rock (2), paper (3) or 0 to quit: 0
Score: 2 (you) 2 (computer) 2 (draw).
Transcribed Image Text:Scissor, rock, paper Write a program called GameSRP.java that plays the popular scissor-rock-paper game where a scissor can cut paper, a rock kan nock a scissor and a paper can wrap a rock. The program asks the user for one of the options (1 for scissor, 2 for rock or 3 for paper) and then randomly picks one of them for the computer. It then presents if you or the computer won, or if it was a draw. If the user enters 0 the program will end and display the total score (number of wins for you and the computer and the draws). Here is a sample run: Scissor (1), rock (2), paper (3) or 0 to quit: 1 You lost, computer had rock! Scissor (1), rock (2), paper (3) or 0 to quit: 2 It's a draw! Scissor (1), rock (2), paper (3) or 0 to quit: 3 You won, computer had rock! Scissor (1), rock (2), paper (3) or 0 to quit: 1 You lost, computer had rock! Scissor (1), rock (2), paper (3) or 0 to quit: 2 It's a draw! Scissor (1), rock (2), paper (3) or 0 to quit: 3 You won, computer had rock! Scissor (1), rock (2), paper (3) or 0 to quit: 0 Score: 2 (you) 2 (computer) 2 (draw).
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY