Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Java, write a method that will be used in the upcoming interface-based CCC (competitive coding contest). Write and test the method //0 = rock,

Using Java, write a method that will be used in the upcoming interface-based CCC (competitive coding contest).
Write and test the method
//0 = rock, 1 = paper, 2 = scissors, 3 = lizard, 4 = Spock
public static int judgeRPSLS(int player1move, int player2move)
This method should take the choices made by two players of Rock-Paper-Scissors-Lizard-Spock and return an int indicating which player won:
Return 1 if player 1 wins
Return 2 if player 2 wins
Return 0 if it's a tie
No value other than 0, 1, or 2 may be returned. The values of the arguments code for the move, as listed above:
0 = rock
1 = paper
2 = scissors
3 = lizard
4 = Spock
If either argument is outside of the range [0, 4], your method should throw an IllegalArgumentException.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Students also viewed these Databases questions

Question

Does it avoid use of underlining?

Answered: 1 week ago