Answered You can hire a professional tutor to get the answer.

QUESTION

I need to add a counter to keep track of the score stopping at a total score of 5 for my rock paper scissor game and the text has caused me some...

I need to add a counter to keep track of the score stopping at a total score of 5 for my rock paper scissor game and the text has caused me some headaches. Below is the source code.

import java.util.Scanner;public class RPS {  public static void main(String[] args) {      Scanner in = new Scanner(System.in);      String playerOne; //Player A -- "R", "P", or "S"      String playerTwo; //Player B      Scanner scan = new Scanner(System.in);      System.out.println(" Player A enter R for Rock, P for Paper, S for Scissors: ");      playerOne = scan.next();      playerOne = playerOne.toLowerCase();      System.out.println("Player B enter R for Rock, P for Paper, and S for Scissors");      playerTwo = scan.next();      playerTwo = playerTwo.toLowerCase();      if (playerOne.equals(playerTwo)) {          System.out.println("Tie");      } else if (playerOne.equals("r")) {          if (playerTwo.equals("s")) {              System.out.println("Rock beats scissors!");          } else if (playerTwo.equals("p")) {              System.out.println("Paper covers Rock!");          } else if (playerOne.equals("p")) {              if (playerTwo.equals("s")) {                  System.out.println("Scissors cut Paper!");              } else if (playerTwo.equals("r")) {                  System.out.println("Paper covers rock, you win!!");              } else if (playerOne.equals("s")) {                  if (playerTwo.equals("p")) {                      System.out.println("Scissors beat paper!");                  }              } else if (playerTwo.equals("r")) {                  System.out.println("Rock beats Scissors");                                                }          }      }  }}
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question