Objectives • Use the static methods and static fields. •Use the method-call/return mechanism. • Use the random-number generation. •...

50.1K

Verified Solution

Question

Programming

Objectives

• Use the static methods and static fields.

•Use the method-call/return mechanism.

• Use the random-number generation.

• Overload methods. Problem Specification

Write a program that lets a user play \"Rock, Paper, Scissors\"against the computer or computer against computer. In user-computergame, the program should ask the user to choose one of the threechoices, and then the computer randomly picks one (without knowingwhat the user has chosen). For this problem, the user should beasked to enter an integer: 1 for rock, 2 for paper, 3 for scissors.Rock beats scissors, scissors beats paper, paper beats rock. Theprogram should say who wins, and then keep playing until someone(the user or the computer) has won 5 rounds. The computer needs tokeep track of the current score and should also display it beforeeach round. In computer-computer game, play for 100 rounds anddisplay which object won majority of the times.

Design Specification

• Create Java class RPS.

• Create static variables for storing Score1 and Score2.

• Create a static method getRandom to get random integer between1 and 3.

• Overload play method like in the below screenshot.

• Play() is for computer vs computer, play(userchoice) is foruser vs computer.

in Java, please

Answer & Explanation Solved by verified expert
3.8 Ratings (567 Votes)
Note Could you plz go through this code and let me know if u    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students