Asked by Nathan
Implement the classic “Rock, Paper, and Scissors game” using following methods:
Headers of the methods are shown
public static void printMenu( )
It is a void method –It uses no parameters --It is called to display choices and code (1 for Rock, 2 for Paper, and 3 for Scissors). When called, it prints the menu choice in a very “user-friendly” manner (i.e. easily readable, using tabs, and spaces for a good display)
public static void displayChoice (int num)
It is a void method, and it uses a single parameter of int type. When called, it prints the choice of player as indicated by the value of parameter (in this example: num). If num is 1, display: Choice of player is “Rock”, and so on.
public static int winnerSelection (int computer, int user)
This is a value returning function, which returns an int type value as follows:
1: if the Computer is the winner
2: if the User is the Winner
3: if it is a tie!
This method should also print appropriate messages such as:
The rock smashes the scissors – so (print one: compuer or user) is the winner
The scissors cuts the paper -– so (print one: compuer or user) is the winner
The paper wraps the rock --– so (print one: compuer or user) is the winner
Headers of the methods are shown
public static void printMenu( )
It is a void method –It uses no parameters --It is called to display choices and code (1 for Rock, 2 for Paper, and 3 for Scissors). When called, it prints the menu choice in a very “user-friendly” manner (i.e. easily readable, using tabs, and spaces for a good display)
public static void displayChoice (int num)
It is a void method, and it uses a single parameter of int type. When called, it prints the choice of player as indicated by the value of parameter (in this example: num). If num is 1, display: Choice of player is “Rock”, and so on.
public static int winnerSelection (int computer, int user)
This is a value returning function, which returns an int type value as follows:
1: if the Computer is the winner
2: if the User is the Winner
3: if it is a tie!
This method should also print appropriate messages such as:
The rock smashes the scissors – so (print one: compuer or user) is the winner
The scissors cuts the paper -– so (print one: compuer or user) is the winner
The paper wraps the rock --– so (print one: compuer or user) is the winner
Answers
Answered by
JAlil
Set up a flowchart for calculating a student’s letter
grade given the following:
90 - 100 = A
80 - 89 = B
70 - 79 = C
60 - 69 = D
below 60 = F
grade given the following:
90 - 100 = A
80 - 89 = B
70 - 79 = C
60 - 69 = D
below 60 = F
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.