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 = "";
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started