Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * File name: GroceryShoppingApp
- *
- * Programmer: Caleb howard
- * ULID: cshowa1
- *
- * Date: Sep 21, 2019
- *
- * Class: IT 168
- * Lecture Section: 001
- * Lecture Instructor: Qi Zhang
- * Lab Section: 002
- * Lab Instructor: Oluwatoba Paul Adegbite
- */
- package edu.ilstu;
- //import scanner
- import java.util.Scanner;
- /**
- *
- * @author Caleb Shawn Howard
- *
- */
- public class GroceryShoppingApp {
- public static void main(String[] args) {
- //Scanner
- Scanner keyboard = new Scanner (System.in);
- //Adding a few statements to call the variables
- GroceryShopping obj = new GroceryShopping(null, null, 0, 0, 0, 0);
- //Vegtable Menu
- /**
- * Displays a Menu with the selected vegetable and fruit
- * with price per pound*/
- System.out.println( "VegtableName" + " "
- + "Price Per Pound" );
- System.out.println("Broccoli \t" + "\t $3.12");
- System.out.println("Yellow Onion \t" + "\t $1.15");
- System.out.println("Chili Pepper \t" + "\t $4.58");
- System.out.println("Green Bundle \t" + "\t $2.82");
- System.out.println("-----------------------------------------");
- // Table One
- /**
- * Table one that provides outupt
- * and input for vegetables and price per pound*/
- System.out.println("Table 1: Vegetable names with "
- + "corresponding price per pound \n");
- // Table One User Input
- /**
- * Prompts the user to enter the selected vegtable name.
- * then the price per pound*/
- System.out.println("Please select the vegetable from Table 1:");
- obj.setnameVegtable(keyboard.nextLine());
- System.out.println("Enter the vegtable price per pound: ");
- obj.setfruitPrice(keyboard.nextDouble());
- System.out.println("\n-----------------------------------------");
- //Fruit Menu
- /**
- * Displays a Menu with the selected vegetable and fruit
- with price per pound*/
- System.out.println( "Fruit Name \t" + " "
- + "Price Per Pound" );
- System.out.println("Apple \t" + " "
- + "$1.73");
- System.out.println("Grape \t" + " "
- + "$2.15");
- System.out.println("Key Lime \t" + " " + "$2.58");
- System.out.println("Navel Orange \t" + " " + "$1.86");
- System.out.println("-----------------------------------------");
- // Table Two
- /**
- * Table one that provides outupt
- * and input for fruits and price per pound*/
- System.out.println("Table 1: Fruit names with "
- + "corresponding price per pound \n");
- /**
- * Prompts the user to select the fruit,
- * then the price per pound*/
- System.out.println("Please select the Fruit from Table 2: ");
- obj.setfruitName(keyboard.nextLine());
- System.out.println("Please enter the price of the selected fruit: \n");
- obj.setfruitPrice(keyboard.nextDouble());;
- System.out.println("-----------------------------------------");
- //GroceryShopping Menu
- /**
- * Grocery Shopping Menu that provides what you select,
- * pounds ordered and Grocery shopping summary */
- System.out.println( "Name" + " "
- + "Price Per Pound" );
- System.out.println(obj.getFruitName() + "\t\t" + obj.getFruitPrice() );
- System.out.println(obj.getVegtableName() + "\t\t" + obj.getVegetablePrice() + "\n");
- System.out.println("-----------------------------------------" + "\n");
- /**
- * Pounds of items ordered
- * */
- System.out.println("Enter the pounds of" + " " + obj.getFruitPrice() + "ordered:");
- obj.setVegtableordered(keyboard.nextDouble());
- System.out.println("Enter the pounds of" + " " + obj.getVegetablePrice() + "ordered:");
- obj.setvegetablePrice(keyboard.nextDouble());;
- System.out.println("-----------------------------------------");
- System.out.println(obj.displayOrderSummary());
- //Close Scanner
- keyboard.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement