Click here to Skip to main content
15,886,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
1. Define constants for Rock, Paper, Scissor. Constants use the final keyword and their identifiers are all captial letters. Define your constants before the main() method (outside of the method – cannot define static within a method).
final static int SISSOR = 0;

2. Prompt the User for their choice.
Enter sissor (0), rock (1), paper (2)

3. Generate a random choice for the computer (note: how do you typecast to int?)
Use Math.random() * range

4. Use switch statements to generate Strings for both the computer and the user’s choice.
switch (compChoice) {
case PAPER: System.out.print("The computer is paper,");
break;
case ROCK: System.out.print("The computer is rock,");
break;
case SISSOR: System.out.print("The computer is sissor,");
break;
}

switch (userChoice) { //todo…


5. Use selection (if – else if – else ) statements to determine it’s a draw or there is a winner.

6. Display the results.
The computer is paper,the user is sissor, You win.

7. Test your results. Verify all possible choices for the User and Computer are generated.


Your output should look like the following ( 3 separate runs ):
Posted
Comments
PIEBALDconsult 17-Sep-15 20:34pm    
Sounds like homework. Try it yourself.
Patrice T 17-Sep-15 21:17pm    
This is Homework, you are the one that to do it.
Start working or tell your teacher where is your problem..
Amarnath S 17-Sep-15 23:12pm    
The best way is to: Close your eyes and think through the solution. You'll have a working solution in not more than an hour.

1 solution

We do not do your HomeWork. homeWork is done to check that you understand what you have been teach. You are the one that have to do it.

So start working or tell your teacher what you don't understand.

Comeback if you have a problem on the work you have done.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900