Question: /* Task 3. * * Input Parameters: * - `p1` : name of player 1 * - `p1Option` : what player 1 plays, either 'r'

/* Task 3. * * Input Parameters: * - `p1` : name of player 1 * - `p1Option` : what player 1 plays, either 'r' (rock), 'p' (paper), or 's' (scissors) * - `p2` : name of player 2 * - `p2Option` : what player 2 plays, either 'r' (rock), 'p' (paper), or 's' (scissors) * * Error conditions (in order of priority): * - None. No error message is needed. You can assume that `p1Option` and `p2Option` are always valid. * * What to return? * - Return the name of player who loses. Or return "tie" when no one loses. * * See the JUnit tests related to this method for the precise format of the string return value. */ public static String getLoserOfRPS(String p1, char p1Option, String p2, char p2Option) { String result = ""; /* Your task is to implement this method, * so that running UtilitiesTester.java will output the expected value to console. * * Do not write any System.out.print(...) or System.out.println(...). * Do not declare any Scanner. * Do not re-assign any of the parameter/input variables. */

/* Your code starts after this line: */ // Do not modify this return statement. return result; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!