title: Java code that prints the customer name, discount level, the original purchase price, promotional price and the amount saved
body: <p>Over all, this code is supposed to ask for the customers name, member level, and original purchase price. It should store all of those in their respective variables, if something other than an accepted member level is entered the program is supposed to exit. After all the variables are stored, the customer's name, member level, original purchase price, promotional price, and amount saved should be printed out in the format at the end of this post. Also, could you tell me if my variables are named correctly and if the whole code is formatted properly. Thanks in advance for any help!</p>
  
  <pre><code>import java.util.*;
  public class Discount{
      public static void main(String[] args){
          Scanner keyboard = new Scanner(System.in);
          double purchase = 0.0;
          double platinum = (purchase * .2);
          double gold = (purchase * .15);
          double silver = (purchase * .1);
          String Platinum = null;
      String Gold = null;
      String Silver = null;
      String customerName = null;
      String level = null;
      double discount = 0.0;
  
      System.out.print("Please enter a customer name: ");
      customerName = keyboard.nextLine();
      System.out.print("Please enter the customer's member level: ");
      level = keyboard.nextLine();
  </code></pre>
  
  <p>This part is supposed to exit the program if anything other than Silver, Gold, or Platinum are printed; however, it will exit no matter what is typed in. If I leave this part out, it will proceed to ask how much the original purchase price but will not print any of the results.</p>
  
  <pre><code>          if (level != "Platinum" || level != "Gold" || level != "Silver")
      {
          System.exit(0);
      }
  
      System.out.print("Please enter the origianl purchase price: ");
      purchase = keyboard.nextDouble();
  
      if (level.equals(Platinum) &amp;&amp; purchase &gt; 500)
      {
          discount = (platinum - (purchase*.05));
          System.out.println("Congratualations, " + customerName + "!");
          System.out.println("As a " + level + " level cardholder, you have received a 25% discount during Bedlam.");
          System.out.printf("%.2f\n", "Origianl purchase price: $" + purchase);
          System.out.printf("%.2f\n", "Promotional price: $" + discount);
          System.out.printf("%.2f\n", "Amount saved: $" + (purchase-discount));
      }
      else if (level.equals(Platinum))
      {
          discount = (platinum);
          System.out.println("Congratualations, " + customerName + "!");
          System.out.println("As a " + level + " level cardholder, you have received a 20% discount during Bedlam.");
          System.out.printf("%.2f\n", "Origianl purchase price: $" + purchase);
          System.out.printf("%.2f\n", "Promotional price: $" + discount);
          System.out.printf("%.2f\n", "Amount saved: $" + (purchase-discount));
      }
      else if (level.equals(Gold))
      {
          discount = (gold);
          System.out.println("Congratualations, " + customerName + "!");
          System.out.println("As a " + level + " level cardholder, you have received a 15% discount during Bedlam.");
          System.out.printf("%.2f\n", "Origianl purchase price: $" + purchase);
          System.out.printf("%.2f\n", "Promotional price: $" + discount);
          System.out.printf("%.2f\n", "Amount saved: $" + (purchase-discount));
      }
      else if (level.equals(Silver))
      {
          discount = (silver);
          System.out.println("Congratualations, " + customerName + "!");
          System.out.println("As a " + level + " level cardholder, you have received a 10% discount during Bedlam.");
          System.out.printf("%.2f\n", "Origianl purchase price: $" + purchase);
          System.out.printf("%.2f\n", "Promotional price: $" + discount);
          System.out.printf("%.2f\n", "Amount saved: $" + (purchase-discount));
      }
      /* Example:
              Congratulations, Marge Simpson!
      As a Silver level cardholder, you received a 10% discount during Bedlam.
      Original purchase price: $500.20
      Promotional price: $450.18
      Amount saved: $50.02 */
  }
  }
  </code></pre>