Advertisement
Guest User

main test file

a guest
Dec 14th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.19 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package Chapter5Test;
  7.  
  8. /*Ch5 Performance  Test
  9. Interface Program
  10. 1) Asks for and accepts orders for one sandwich, one drink, and
  11.    up to 2 side dishes.  
  12. 2) A null response to any item is acceptable
  13. 3) The parameters to be passed to the instance variables for having the
  14.     sandwich toasted or cut should be set to "Y" or "N"
  15. */
  16.  
  17. //Menu Interface Program
  18. import java.util.Scanner;
  19.  
  20. public class Chapter5Test
  21. {
  22.     public static void main (String [] args)
  23.     {
  24.         Scanner reader = new Scanner(System.in);
  25.         Sandwiches Sandwich1;   // one sandwich
  26.     Drinks Drink1;         // one drink
  27.     Sides Side1;
  28.         Sides Side2;   // two side dishes
  29.     //Private variables to accept responses to items for the order
  30.         String MainIngrd, SecIngrd, ExtLayer, Cond, Fix ,Side, Size, Serve,
  31.                 Beverage,toaststatus, Y_N = "";
  32.     Sandwich1 = new Sandwiches();
  33.     Drink1 = new Drinks();
  34.     Side1 =  new Sides();
  35.     Side2 =  new Sides();
  36.         //reader.nextLine();
  37.       // Request the input
  38.         System.out.print("What type of sandwich would you like? ");
  39.         MainIngrd = reader.nextLine();
  40.         Sandwich1.SetMainIngredient(MainIngrd);
  41.  
  42.         System.out.print("What additional ingredient would you like? ");
  43.         SecIngrd = reader.nextLine();
  44.     Sandwich1.SetSecIngredient(SecIngrd);
  45.  
  46.         System.out.print("How would you like your sandwich enclosed? ");
  47.         ExtLayer = reader.nextLine();
  48.     Sandwich1.SetExteriorLayer(ExtLayer);
  49.  
  50.     System.out.println("Please enter the first of 3 possible condiments ");
  51.         System.out.print("Press enter if you do not wish a condiment ");
  52.     Cond = reader.nextLine();
  53.     Sandwich1.SetCondiment(Cond,1);
  54.        
  55.     System.out.println("Please enter the second of 3 possible condiments ");
  56.         System.out.print("Press enter if you do not wish a condiment ");
  57.     Cond = reader.nextLine();
  58.     Sandwich1.SetCondiment(Cond,2);
  59.        
  60.     System.out.println("Please enter the third of 3 possible condiments ");
  61.     System.out.print("Press enter if you do not wish a condiment ");
  62.     Cond = reader.nextLine();
  63.     Sandwich1.SetCondiment(Cond,3);
  64.      
  65.     System.out.println("Please enter the first of 2 possible fixings ");
  66.         System.out.print("Press enter if you do not wish a fixing ");
  67.     Fix = reader.nextLine();
  68.     Sandwich1.SetFixing(Fix,1);
  69.    
  70.     System.out.println("Please enter the second of 2 possible fixings ");
  71.         System.out.print("Press enter if you do not wish a fixing ");
  72.     Fix = reader.nextLine();
  73.     Sandwich1.SetFixing(Fix,2);
  74.      
  75.         System.out.print("Please enter how you would like your sandwich served? ");
  76.         Serve = reader.nextLine();
  77.     Sandwich1.SetService(Serve);
  78.      
  79.         System.out.print("Would you like to have your sandwich toasted? (Enter Toasted or not Toasted)");
  80.         toaststatus = reader.nextLine();
  81.     Sandwich1.SetToast(Y_N);
  82.        
  83.       System.out.print("Would you like to have your sandwich cut? (Y/N)");   
  84.           Y_N = reader.nextLine();
  85.       Sandwich1.SetCut(Y_N);
  86.      
  87.       System.out.print("What would you like to drink? ");    
  88.           Beverage = reader.nextLine();
  89.          
  90.           System.out.print("What size? ");   
  91.           Size = reader.nextLine();
  92.          
  93.       Drink1.SetDrink(Beverage,Size);
  94.  
  95.       System.out.println("Please enter the first of 2 possible side dishes ");
  96.       System.out.print("Press enter if you do not wish a side dish ");          
  97.       Side = reader.nextLine();
  98.          
  99.           System.out.print("What size? ");
  100.       Size = reader.nextLine();
  101.       Side1.SetSide(Side,Size);
  102.        
  103.       System.out.println("Please enter the second of 2 possible side dishes ");
  104.       System.out.print("Press enter if you do not wish a side dish ");          
  105.       Side = reader.nextLine();
  106.          
  107.           System.out.print("What size? ");
  108.       Size = reader.nextLine();
  109.       Side2.SetSide(Side,Size);
  110.          
  111.          
  112.           System.out.println(Sandwich1);
  113.           System.out.println(Drink1);
  114.            System.out.println(Side1);          
  115.           System.out.println(Side2);
  116.  
  117.              }
  118.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement