title: I am having issues with a repeating while loop in a switch statement, the loop continues to repeat
body: <p>I'm a newbie coder and for a class I was required to make a vending machine-like code. However, I used a switch statement as part of it. An issue I faced is that in those if statements I added a check.  The check was to ask if the user would like to continue or not, but for some reason it repeats even after an input. I wasn't entirely sure if this question was asked before, but a lot of my friends share the issue. </p>
  
  <pre><code>import java.util.Scanner;
  public class hw52 {
  public static void main(String[] args) {
      Scanner keyboard = new Scanner(System.in);
      String choice;
      String answer = "";
      int cr = 0;
      int wb = 0;
      int ch = 0;
      int k = 0;
      int j = 0;
      boolean check =  true;
      double cost2;
      double discount;
      double change = 0;
      double cost = 0;
      double money = 0;
      int counter = 0;
      do {
          answer = "";
          System.out.println("Select an option in the vending machine. \n 
  Crunch:$1.50 \n Water bottle:$2.00 \n Chips:$1.00 \n Ketchup:$4.00 \n 
  Juice:$2.50");
          choice = keyboard.nextLine();
          switch(choice.toUpperCase()){
          case "CRUNCH":
              cost += 1.5;
              cr ++;
              counter ++;
              System.out.println("Cost: " + cost);
              while(check = true) {
              System.out.println("Do you want to continue? Yes or no?");
              answer = keyboard.nextLine();
              if (answer.equalsIgnoreCase("Yes")) {
                  check = false;
              }else if(answer.equalsIgnoreCase("Yes")) {
                  check = false;
              }else {
                  System.out.println("Bad input.");
              }
              }
          case "WATER BOTTLE":
              cost += 2.00;
              wb++;
              counter ++;
              System.out.println("Cost: " + cost);
              while(check = true) {
                  System.out.println("Do you want to continue? Yes or no?");
                  answer = keyboard.nextLine();
                  if (answer.equalsIgnoreCase("Yes")) {
                      check = false;
                  }else if(answer.equalsIgnoreCase("Yes")) {
                      check = false;
                  }else {
                      System.out.println("Bad input.");
                  }
                  }
          case "CHIPS":
              cost += 1.00;
              ch++;
              counter ++;
              System.out.println("Cost: " + cost);
              System.out.println("Cost: " + cost);
              while(check = true) {
                  System.out.println("Do you want to continue? Yes or no?");
                  answer = keyboard.nextLine();
                  if (answer.equalsIgnoreCase("Yes")) {
                      check = false;
                  }else if(answer.equalsIgnoreCase("Yes")) {
                      check = false;
                  }else {
                      System.out.println("Bad input.");
                  }
                  }
          case "KETCHUP":
              cost += 5.00;
              k++;
              counter ++;
              System.out.println("Cost: " + cost);
              while(check = true) {
                  System.out.println("Do you want to continue? Yes or no?");
                  answer = keyboard.nextLine();
                  if (answer.equalsIgnoreCase("Yes")) {
                      check = false;
                  }else if(answer.equalsIgnoreCase("Yes")) {
                      check = false;
                  }else {
                      System.out.println("Bad input.");
                  }
                  }
          case "JUICE":
              cost += 2.50;
              j++;
              counter ++;
              System.out.println("Cost: " + cost);
              while(check = true) {
                  System.out.println("Do you want to continue? Yes or no?");
                  answer = keyboard.nextLine();
                  if (answer.equalsIgnoreCase("Yes")) {
                      check = false;
                  }else if(answer.equalsIgnoreCase("Yes")) {
                      check = false;
                  }else {
                      System.out.println("Bad input.");
                  }
                  }
          default: 
              System.out.println("Not a choice! Use exact names.");
              answer = "yes";
          }
      }while(!answer.equalsIgnoreCase("no"));
      counter /= 3;
      for (int i = 0; i &lt; counter;i++) {
          discount = (double)(Math.random()*.1)+.1;
          cost2 = cost * discount;
          cost -= cost2;
      }   
      while(money &lt; cost) {
      System.out.println("How much money would you like to use to pay?");
      money = keyboard.nextDouble();
      if (money &lt; cost) {
          System.out.println("That's not enough money.");
      }
      }
      double Q = cost / .25;
      double D = (cost % .25) / .10;
      double N = ((cost % .25) % .10) / .05 ;
      double P = (((cost % .25) % .10) %.05) /.01;
      System.out.println("The items you bought are: \n Crunch Bars: " + cr + 
  "\n Water Bottles: " + wb + "\n Chips: " + ch + "\n Ketchup: " + k + "\n 
  Juice: " + j);
      System.out.println("Your change is: $" + ((Q * .25) + (D * .1) + (N * 
  .05) + (P*.01))); 
      }
  
  }
  </code></pre>
  
  <p>Please excuse my messy coding style. I personally like it better, but I know a lot of people find it strange. </p>