Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use Java Problem 5. Game: Scissor, rock, paper (Game.java) Descriptions: Write a Java class named Game that plays the popular scissor-rock- paper game. (A

Please use Java
image text in transcribed
Problem 5. Game: Scissor, rock, paper (Game.java) Descriptions: Write a Java class named Game that plays the popular scissor-rock- paper game. (A scissor can cut a paper, a rock can knock a scissor, and a paper can wrap a rock.) The program randomly generates a number 0, 1, or 2 representing scissor, rock, and paper. The program prompts the user to enter a number 0, 1, or 2 and displays a message indicating whether the user or the computer wins, loses, or draws. Play the gam until either the computer or the user can win more than successively two times. Outputs: Scissor(o), rock(1), paper (2): 1 The computer is scissor You are rock You won Scissor(0), rock(1), paper(2): 2 The computer is rock You are paper You won Scissor(0), rock(1), paper(2): 0 The computer is paper You are scissor You won Game Over! Problem 6. Lottery Numbers (Lottery.java) Descriptions: Write a Java class named Lottery that can generate a lottery of two-digit number. It is required that the two digits in the number are distinct. (Hint: Generate the first digit, and then use a loop to continuously generate the second digit until it is difference from the first digit). You are required to use the do-while loop to implement it. Outputs: $java Lottery The first digit is 7 The second digit is 5

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

Step: 3

blur-text-image

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

Students also viewed these Databases questions