title: && and || in while loop problems
body: <p>I have been assigned to make a dice game of high or low for my intro to java course. I have all the methods completed, however, I need to use a while loop so that I can continue to play the game until my cash hits 0 or if I bet 0 dollars. I do not want to use a break if I do not have to. So my question is what can I do (if possible) to just only use the while loop? Here is my program:</p>
  
  <pre><code>public static void main(String[] args) {
      Scanner in = new Scanner(System.in);
      int cash = 100;
      int bet = 1
  
      while(cash &gt; 0 || bet != 0)
      {
  
          bet = getBet(in, cash);
  
          char choice = getHighLow(in);
  
          int roll1 = getRoll();
          System.out.println("Dice 1 rolls: " + roll1);
  
          int roll2 = getRoll();
          System.out.println("Dice 2 rolls: " + roll2);
  
          int total = (roll1 + roll2);
          System.out.println("The total roll is: " + total);
  
          int winnings = determineWinnings(choice, bet, total);
  
          cash = cash + winnings;
      }
  
      System.out.println("You have " + cash + " dollars left. Goodbye!");
  
  
  
  }
  
  
  // Given a Scanner and a current maximum amount of money, prompt the user for
  // an integer representing the number of dollars that they want to bet.  This
  // number must be between 0 and to maximum number of dollars.  If the user enters
  // a number that is out of bounds, display an error message and ask again.
  // Return the bet to the calling program.
  private static int getBet(Scanner inScanner, int currentPool) {
      System.out.println("You have " + currentPool + " dollars");
      System.out.println("Enter and amount to bet (0 to quit): ");
  
      int bet = inScanner.nextInt();
  
  
      while (0 &gt; bet || currentPool &lt; bet )
      {
          System.out.println("Your bet must be between 0 and " + currentPool + " dollars ");
          bet = inScanner.nextInt();
      }
  
      return bet;
  
  }
  
  // Given a Scanner, prompt the user for a single character indicating whether they
  // would like to bet High ('H'), Low ('L') or Sevens ('S').  Your code should accept
  // either capital or lowercase answers, but should display an error if the user attempts
  // to enter anything but one of these 3 values and prompt for a valid answer.
  // Return the character to the calling program.
  private static char getHighLow(Scanner inScanner) {
      System.out.println("High, low or sevens (H/L/S): ");
  
      inScanner.nextLine();
  
      char choice = inScanner.nextLine().charAt(0);
      choice = Character.toUpperCase(choice);
  
      while (choice != 'H' &amp;&amp; choice != 'L' &amp;&amp; choice != 'S')
      {
          System.out.println("You must choose between high, low or sevens (H/L/S): ");
          choice = Character.toUpperCase(inScanner.nextLine().charAt(0));
      }
  
      return choice;
  
  
  }
  
  // Produce a random roll of a single six-sided die and return that value to the calling
  // program
  private static int getRoll() {
      Random generate = new Random();
  
      int roll = generate.nextInt(6) + 1;
  
      return roll;
  
  }
  
  // Given the choice of high, low or sevens, the player's bet and the total result of
  // the roll of the dice, determine how much the player has won.  If the player loses
  // the bet then winnings should be negative.  If the player wins, the winnings should
  // be equal to the bet if the choice is High or Low and 4 times the bet if the choice
  // was Sevens.  Return the winnings to the calling program.
  private static int determineWinnings(char highLow, int bet, int roll) {
  
      if(roll &lt;= 6)
      {
          if(highLow == 'L')
          {
              System.out.println("You won " + bet + " dollars! ");
              return bet;
          }
  
          else
              System.out.println("You lose! ");
              return -bet;
      }
  
      else if (roll == 7)
      {
          if(highLow == 'S')
          {
              System.out.println("You won " + (bet * 4) + " dollars! ");
              return (bet * 4);
          }
  
          else
              System.out.println("You lose! ");
              return -bet;
      }
  
      else
      {
          if(highLow == 'H')
          {
              System.out.println("You won " + bet + " dollars! ");
              return bet;
          }
  
          else
              System.out.println("You lose! ");
              return -bet;
      }
  
  }
  </code></pre>
  
  <p>}</p>