Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.17 KB | None | 0 0
  1. /*
  2. * File name: GroceryShoppingApp
  3. *
  4. * Programmer: Caleb howard
  5. * ULID: cshowa1
  6. *
  7. * Date: Sep 21, 2019
  8. *
  9. * Class: IT 168
  10. * Lecture Section: 001
  11. * Lecture Instructor: Qi Zhang
  12. * Lab Section: 002
  13. * Lab Instructor: Oluwatoba Paul Adegbite
  14.  */
  15. package edu.ilstu;
  16.  
  17. //import scanner
  18.     import java.util.Scanner;
  19.    
  20. /**
  21.  *
  22.  * @author Caleb Shawn Howard
  23.  *
  24.  */
  25. public class GroceryShoppingApp {
  26.    
  27.     public static void main(String[] args) {
  28.  
  29.         //Scanner
  30.         Scanner keyboard = new Scanner (System.in);
  31.        
  32.         //Adding a few statements to call the variables
  33.         GroceryShopping obj = new GroceryShopping(null, null, 0, 0, 0, 0);
  34.                        
  35.                            
  36.         //Vegtable Menu
  37.             /**
  38.              * Displays a Menu with the selected vegetable and fruit
  39.              * with price per pound*/
  40.                
  41.                 System.out.println( "VegtableName" + "         "
  42.                 + "Price Per Pound" );
  43.                 System.out.println("Broccoli \t" + "\t $3.12");
  44.                 System.out.println("Yellow Onion \t" + "\t $1.15");
  45.                 System.out.println("Chili Pepper \t" + "\t $4.58");
  46.                 System.out.println("Green Bundle \t" + "\t $2.82");
  47.                 System.out.println("-----------------------------------------");
  48.        
  49.         // Table One
  50.             /**
  51.              * Table one that provides outupt
  52.              * and input for vegetables and price per pound*/
  53.                
  54.                 System.out.println("Table 1: Vegetable names with "
  55.                         + "corresponding price per pound \n");
  56.                
  57.         // Table One User Input
  58.                  /**
  59.                   * Prompts the user to enter the selected vegtable name.
  60.                   * then the price per pound*/
  61.                        
  62.                         System.out.println("Please select the vegetable from Table 1:");   
  63.                         obj.setnameVegtable(keyboard.nextLine());
  64.                        
  65.                        
  66.                         System.out.println("Enter the vegtable price per pound: ");
  67.                         obj.setfruitPrice(keyboard.nextDouble());
  68.                         System.out.println("\n-----------------------------------------");
  69.        //Fruit Menu
  70.                 /**
  71.                  *  Displays a Menu with the selected vegetable and fruit
  72.                     with price per pound*/
  73.                         System.out.println( "Fruit Name \t" + "         "
  74.                                 + "Price Per Pound" );
  75.                         System.out.println("Apple \t" + "                 "
  76.                                 +  "$1.73");
  77.                         System.out.println("Grape \t" + "                 "
  78.                                 + "$2.15");
  79.                         System.out.println("Key Lime \t" + "         " + "$2.58");
  80.                         System.out.println("Navel Orange \t" + "         " +  "$1.86");
  81.                         System.out.println("-----------------------------------------");
  82.       // Table Two 
  83.                 /**
  84.                 * Table one that provides outupt
  85.                 * and input for fruits and price per pound*/
  86.                            
  87.                         System.out.println("Table 1: Fruit names with "
  88.                                     + "corresponding price per pound \n");
  89.                 /**
  90.                 * Prompts the user to select the fruit,
  91.                 * then the price per pound*/   
  92.                            
  93.                        
  94.                         System.out.println("Please select the Fruit from Table 2: ");  
  95.                         obj.setfruitName(keyboard.nextLine());
  96.                                
  97.                        
  98.                         System.out.println("Please enter the price of the selected fruit: \n");
  99.                         obj.setfruitPrice(keyboard.nextDouble());;
  100.                         System.out.println("-----------------------------------------");
  101.            
  102.         //GroceryShopping Menu
  103.             /**
  104.                  * Grocery Shopping Menu that provides what you select,
  105.                  * pounds ordered and Grocery shopping summary */
  106.        
  107.                         System.out.println( "Name" + "         "
  108.                                 + "Price Per Pound" );
  109.                        
  110.                         System.out.println(obj.getFruitName() + "\t\t" + obj.getFruitPrice() );
  111.                         System.out.println(obj.getVegtableName() + "\t\t" + obj.getVegetablePrice() + "\n");
  112.                        
  113.                         System.out.println("-----------------------------------------" + "\n");
  114.                    
  115.                     /**
  116.                      *  Pounds of items ordered
  117.                      * */
  118.                        
  119.                        
  120.                         System.out.println("Enter the pounds of" + " " + obj.getFruitPrice() + "ordered:");
  121.                         obj.setVegtableordered(keyboard.nextDouble());
  122.                                
  123.                        
  124.                         System.out.println("Enter the pounds of" + " " + obj.getVegetablePrice() + "ordered:");
  125.                         obj.setvegetablePrice(keyboard.nextDouble());;
  126.                         System.out.println("-----------------------------------------");
  127.                        
  128.                         System.out.println(obj.displayOrderSummary());
  129.                        
  130.                        
  131.                    
  132.                        
  133.                        
  134.                        
  135.            
  136.                            
  137. //Close Scanner
  138.         keyboard.close();
  139.        
  140.        
  141.        
  142.     }
  143. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement