Question: 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
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
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
