| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- package com.zipcodewilmington.productmanager;
-
- import java.sql.SQLOutput;
- import java.util.Scanner;
- import java.util.*;
-
-
- /**
- * Created by leon on 1/10/18.
- */
- public class MainApplication {
-
- private static int id = 6;
-
-
- public static void main(String[] args) {
- Product jacket = new Product("Jacket", 1, 29.99, 5);
- Product hat = new Product("Hat", 2, 9.99, 15);
- Product shirt = new Product("Shirt", 3, 14.99, 10);
- Product pants = new Product("Pants", 4, 19.99, 10);
- Product shoes = new Product("Shoes", 5, 29.99, 5);
-
- Scanner scan = new Scanner(System.in);
- int toDo = 0;
-
- while (toDo != 8) {
- System.out.println("What would you like to do?");
- System.out.println("Type '1' to ADD a product");
- System.out.println("Type '2' to REMOVE a product");
- System.out.println("Type '3' to FIND a product by ID");
- System.out.println("Type '4' to FIND a product by NAME");
- System.out.println("Type '5' to ADD a QUANTITY to the Inventory");
- System.out.println("Type '6' to REMOVE a QUANTITY to the Inventory");
- System.out.println("Type '7' to PRINT list of inventory");
- System.out.println("Type '8' to QUIT");
- toDo = scan.nextInt();
- Inventory invent = new Inventory();
-
-
- switch (toDo) {
- case 1:
- id++;
- System.out.println("What is the NAME of the PRODUCT would you like to ADD?");
- String addProduct = scan.next();
- System.out.println("What is the PRICE of the " + addProduct + "?");
- Double addProductPrice = scan.nextDouble();
- System.out.println("What is the QUANTITY of " + addProduct + " that you would like to add?");
- int addProductQuantity = scan.nextInt();
- System.out.println("PRODUCT\tID\tQUANITY\tPRICE\t");
- System.out.println(addProduct + "\t" + id + "\t" + addProductQuantity + "\t\t" + addProductPrice);
-
-
- Product product = new Product(addProduct, id, addProductPrice, addProductQuantity);
- break;
- case 2:
- id--;
- System.out.println("How would you like to remove the product?");
- System.out.println("Type '1' to REMOVE by ID:");
- System.out.println("Type '2' to REMOVE by NAME:");
- int howToRemove = scan.nextInt();
-
-
- if (howToRemove == 1) {
- System.out.println("What is the ID of the product to be REMOVED?");
- int idToRemove = scan.nextInt();
- invent.list.remove(idToRemove);
- } else {
- System.out.println("What is the NAME of the product to be REMOVED?");
- String nameToRemove = scan.next();
- invent.list.remove(nameToRemove);
- }
- break;
- case 3:
- System.out.println("What is the ID of the product?");
- int idToFind = scan.nextInt();
- invent.findProductById(idToFind);
- System.out.println("PRODUCT\tID\tQUANITY\tPRICE\t");
- // System.out.println(addProduct + "\t" + id + "\t" + addProductQuantity + "\t\t" + addProductPrice);
- break;
- case 4:
- System.out.println("What is the NAME of the product?");
- String nameToFind = scan.next();
- invent.findProductByName(nameToFind);
- System.out.println("PRODUCT\tID\tQUANITY\tPRICE\t");
- // System.out.println(addProduct + "\t" + id + "\t" + addProductQuantity + "\t\t" + addProductPrice);
- break;
- case 5:
- System.out.println("What product do you want to add to?");
- nameToFind = scan.next();
- System.out.println("How many " + nameToFind + "'s do you want to add?");
- int totalToAdd = scan.nextInt();
- invent.addQuantity(nameToFind, totalToAdd);
-
- break;
- case 6:
- break;
- case 7:
- invent.printInventory();
-
- break;
- }
-
- }
-
- }
-
- }
|