I'm in an introductory programming class, and one of our assignments is to complete a Rock Paper Scissors program using nested switch statements
First of all, this method might be completely wrong in the first place, but currently every time I compile it it says I'm missing a return statement at the end, so I don't know what that's about either.
Any help would be appreciated. Thanks
/**
* returns -1 if the player wins,
* 0 if it's a tie, and 1 if the computer wins
*/
private int nextPlay(char computerMove, char playerMove)
{
switch(playerMove)
{
case 'R':
switch(computerMove)
{
case 'R':
return 0;
case 'P':
return 1;
case 'S':
return -1;
}
break;
case 'P':
switch(computerMove)
{
case 'R':
return -1;
case 'P':
return 0;
case 'S':
return 1;
}
break;
case 'S':
switch(computerMove)
{
case 'R':
return 1;
case 'P':
return -1;
case 'S':
return 0;
}
break;
}
(MISSING RETURN STATEMENT)
}