title: How Do I Get Customer Input To Display?
body: <p>I am in an Object-Oriented Programming course in college and I have to use Java to start a program that will eventually incorporate a full on GUI by the end of the course.  For the beginning of this project, I have to basically use message boxes to set up how a customer would order a sub to be delivered to their home.</p>
  
  <p>Here's what I have so far:</p>
  
  <p>This is the main class</p>
  
  <pre><code>import javax.swing.*;
  
  //Here is the main class
  
  public class Subs {
      public static void main(String[] args) {
          // Begin Main Method
          char letter;
          String input;
          String input1, input2, input3, input4, input6, input8;
      int input5, input7;
          int subL; //length of sub in inches
          int cup; //size of drink in ounces
  
          JFrame frame = new JFrame("Message");
  
  
          JOptionPane.showMessageDialog(frame, "Welcome to Famous Subs! ");
          input1 = JOptionPane.showInputDialog(frame, "Please Enter Your Name:       ");
          input2 = JOptionPane.showInputDialog(frame, "Please Enter Your Address: ");
          do { 
              input3 = JOptionPane.showInputDialog(frame, "What kind of sub would "
                  + "you like? " +
                  "\n Turkey Club" +
                  "\n Philly" +
                  "\n Meatball" +
                  "\n Chicken Parm");
  
              input4 = JOptionPane.showInputDialog(frame, "What type of bread? " +
                  "\n White" +
                  "\n Wheat" +
                  "\n Rosemary" +
                  "\n Italian Herb");
              subL = getValidLength();
  
              input6 = JOptionPane.showInputDialog(frame, "What would you like to "
                  + "to drink? " +
                  "\n Water" +
                  "\n Soda" +
                  "\n Juice");
              cup = getValidCup ();
              input8 = JOptionPane.showInputDialog(frame, "Do you wish to continue?\n "+
                                               "'y' or 'Y' for YES\n"+
                                               "'n' or 'N' for NO\n");
              Order firstOrder = new Order(input1, input2, input3, input4, input6, subL, cup);
          JOptionPane.showMessageDialog(frame, firstOrder.toString());
          letter = input1.charAt(0);
          }
  
          while (letter == 'Y'|| letter == 'y');
  
          System.exit(0);
  
      }
  
      private static int getValidLength()
  {
      int s;
      String input5;
      do{
          input5 = JOptionPane.showInputDialog(null, "What size of sub do you wish "
                                                + "to order? "+
                                                "\n 6 inch"+
                                                "\n 12 inch");
          s = Integer.parseInt(input5);
      } while (!(s==6 || s==12));
      return s;
  }
  
      private static int getValidCup()
      {
          int c;
          String input8;
          do{
              input8 = JOptionPane.showInputDialog(null, "What size drink? " +
                  "\n Small 12oz." +
                  "\n Medium 24oz." +
                  "\n Large 36oz.");
  
              c = Integer.parseInt(input8);
          }
          while (!(c==12 || c==24 || c==36));
          return c;
      }
  
  }
  </code></pre>
  
  <p>This is my subclass</p>
  
  <pre><code>//This is the class for the order
  
  public class Order {
  
      //creating my variables
      private String Customer;
      private String Address;
      private String name;
      private String bread;
      private String drink;
      private int length; //in inches
      private int size; //in ounces
      private double SubPrice;
      private double DrinkPrice;
      private double total;
  
  
      //blank constructor
      public Order(){}
      //Create a constructor to hold variables
      public Order (String Customer, String Address, String name, String bread, String drink, int subL, int cup){
  
          this.Customer = Customer;
          this.Address = Address;
          this.name = name;
          this.bread = bread;
          this.drink = drink;
          subL = length;
          cup = size;
      } 
  
  
      //create the getters and setters for the variables
  
      public String getCustomer(){
      return Customer;
  }
  
  public void setCustomer(String Customer){
      this.Customer = Customer;
  }
  
  public String getAddress(){
      return Address;
  }
  
  public void setAddress(String Address){
      this.Address = Address;
  }
      public String getName(){
          return name;
      }
  
      public void setName(String name){
          this.name = name;
      }
  
      public String getBread(){
          return bread;
      }
  
      public void setBread(String bread){
          this.bread = bread;
      }
  
      public String getDrink(){
          return drink;
      }
  
      public void setDrink(String drink){
          this.drink = drink;
      }
  
      public int getLength(){
          return length;
      }
  
      public void setLength (int length){
          this.length = length;
      }
  
      public int getSize(){
          return size;
      }
  
      public void setSize (int size){
          this.size = size;
      }
  
      public void setSubPrice (int subL, double SubPrice){
          if (subL == 6)
              SubPrice = 7.95;
          else if (subL == 12)
              SubPrice = 12.75;
      }
  
      public void setDrinkPrice(int cup, double DrinkPrice){
          if (cup == 12)
              DrinkPrice = 2.00;
          else if (cup == 24)
              DrinkPrice = 4.00;
          else if (cup == 36);
              DrinkPrice = 6.00;
      }
  
      public void setTotal(){
          total = SubPrice + DrinkPrice;
      }
  
      @Override
      public String toString(){
          String grandOrder = "Greetings " + Customer +
              "\nHere is your order: " +
              "\n" + name +
              "\n" + bread +
              "\n" + drink +
              "\nThe length of your sub is: " + length +
              "\nThe size of your drink is: " + size +
              "\nThe Price for your sub is: " + SubPrice +
              "\nThe Price for your drink is: " + DrinkPrice +
              "\nHere is your total: $" + calculateTotal(DrinkPrice, SubPrice) +
              "\nThis will be delivered to: " + Address;
          return grandOrder;
      }
  }
  </code></pre>
  
  <p>Everything runs just fine except the fact that the last box to show up returns all the string fields as null and the int and double variables as 0 or 0.0.</p>
  
  <p><a href="https://i.stack.imgur.com/YOHAb.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YOHAb.jpg" alt="enter image description here"></a></p>
  
  <p>How do I return the values for what the user inputs on each dialog box? In addition, how do I get he customer's name and address to appear on this final screen?  Thanks.</p>