Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please in Java creat this program It is Object Oriented Design so u need to write two codes one is GameFunctions.jave And the second GameDemo.java
Please in Java creat this program
Create a program that plays a game of rock, paper, scissors. Your program should allow the user to enter "rock", "paper", or "scissors". The program will randomly select "rock, "paper", or "scissors'. The winner is then printed. GameFunctions Class (GameFunctions.java) This class should contain only two static methods: getRPS-Accepts no arguments; Randomly picks a number between 1, 2 and 3, each one associated with "rock", "paper", or "scissors". The function should return the String value "rock", "paper", or "scissors". whoWon- Accepts two arguments-The first is the user's pick, the second is the program's pick. The function should return "user" if the user won, "computer" if the program won, or "tie" if neither won. o Rules for determining the winner: Rock beats Scissors Scissors beats Paper Paper beats Rock If the user and computer made the same choice, it's a tie. GameDemo Class (GameDemo.java This is the class that will use the static methods from the GameFunctions class you created In the main method: . Prompt the user to enter their choice. Reject any values other than "rock", "paper", or "scissors" by displaying an error message and prompt the user to reenter their choice. Then use the getRPS method from the GameFunctions class to get the computer's choice. Pass the user's choice and the computer's choice to the whoWon method from the GameFunctions class. Based on the value returned by the method, print the winner .Ask the user if they would like to play again. If they choose to play again, start the game over from the beginning It is Object Oriented Design so u need to write two codes one is GameFunctions.jave
And the second GameDemo.java as instructed in the photo check the last 2 photos and the sample in/op to have an Idea
Thanks in advance
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started