SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 5 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 16 Oct 2017 My Price 7.00

I need to add a counter to keep track of the score stopping

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");
                  
                              }
          }
      }
  }
}

Answers

(5)
Status NEW Posted 16 Oct 2017 08:10 AM My Price 7.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)