Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import java.util.*;
- public class main {
- Scanner input = new Scanner(System.in);
- public static void main(String[] args) { // testing add/update/remove on supplier
- Scanner input = new Scanner(System.in);
- ArrayList<Supplier> spl = new ArrayList<Supplier>();
- ArrayList<Cart> cpl = new ArrayList<ShoppingCart>();
- ArrayList<Customer> cul = new ArrayList<Customer>();
- ArrayList<Warehouse> wal = new ArrayList<Warehouse>();
- ArrayList<Sales> sal = new ArrayList<Sales>();
- ArrayList<Product> ppl = new ArrayList<Product>();
- ArrayList<Manager> mspl = new ArrayList<Manager>();
- ArrayList<SalesStaff> sspl = new ArrayList<SalesStaff>();
- ArrayList<WarehouseStaff> wspl = new ArrayList<WarehouseStaff>();
- Supplier s1 = new Supplier("s1", "dasd", "asdsa", "asdsa", "asdsa");
- spl.add(s1);
- /*
- Manager m1 = new Manager("m1","a","a","a",1,"a",2,"a");
- mspl.add(m1);
- SalesStaff ss1 = new SalesStaff("ss1","a","a","a",1,"a",2,"a");
- sspl.add(ss1);
- WarehouseStaff ws1 = new WarehouseStaff("ws1","a","a","a",1,"a",2,"a");
- wspl.add(ws1);
- System.out.println(m1.displayAll());
- System.out.println(ss1.displayAll());
- System.out.println(ws1.displayAll());
- Customer c1 = new Customer("John", "c1" , "125 therry st", 1231312, 'M', "1/1/1", "email@email.com", 0.0);
- cul.add(c1);
- Supplier s1 = new Supplier("s1","James", "Tut", "email@email.com" , "0423400");
- Supplier s2 = new Supplier("s3","James3", "Tut", "email@email.com" , "0423400");
- spl.add(s1);
- spl.add(s2);
- //Product p1 = new Product (s1 ,"p1" , "baana" , 123 , 5.0 , 0.0, 5, 0.0);
- //Product p2 = new Product (s2, "p2" , "Apple", 124, 12.0, 0.0, 6, 0.0);
- ppl.add(p1);
- ppl.add(p2);
- Warehouse wa1 = new Warehouse(p1, 100, 30, 100);
- wal.add(wa1);
- ArrayList <Payment> pyl = new ArrayList<Payment>();
- // ShoppingCart sh1 = new ShoppingCart(c1, p1, "ca1", 71 , 5.0);
- //cpl.add(sh1);
- s1.updateCompany("rae");
- //Payment py1 = new Payment("py1", sh1);
- //pyl.add(py1);
- //wa1.qtyAfter(py1);
- wa1.reorder();
- //Sales sa1 = new Sales("sa1",p1,wa1, sh1);
- //sal.add(sa1);
- /*
- * option 1 as customer
- * option 1.1 as check price
- * System.out.println("Please enter ID to show discount");
- String sID = input.nextLine();
- c1.searchProductPrice(ppl, sID);
- //ss1.removeItems(cpl, sh1);
- System.out.println(cpl.toString() + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
- System.out.println("+++++++++++++++++++++++++++++++++");
- m1.updateProductPrice(ppl, p1,10.00 );
- System.out.println("+++++++++++++++++++++++++++++++++");
- System.out.println(ppl.toString());
- ws1.updateStock(wa1);
- System.out.println("Please enter ID to show price");
- String sID = input.nextLine();
- c1.searchProductPrice(ppl, sID);
- System.out.println("Please enter ID to show discount");
- String dID = input.nextLine();
- c1.searchProductDiscount(ppl, dID);
- System.out.println(wa1.toString()); */
- //Supplier s1 = new Supplier("s1","James", "Tut", "email@email.com" , "0423400");
- spl.add(s1);
- int option;
- Supplier spID = new Supplier();
- do
- {
- System.out.println("\t**********\tMenu\t**********");
- System.out.println("login as Customer\t1\n" +
- "login as Staff\t\t2\n" +
- "exit\t\t0");
- System.out.println("which option you want to pick?");
- option = input.nextInt();
- switch(option)
- {
- case 1: // Customer Menu
- System.out.println("\t**********\tCustomer\t**********");
- System.out.println("Check product price\t1");
- System.out.println("Check product weight\t2");
- System.out.println("Add Item\t\t3");
- System.out.println("Call assistant\t\t4");
- System.out.println("Pay\t\t\t5");
- System.out.println("which option you want to pick?");
- int cusOption = input.nextInt(); // customer option
- switch(cusOption)
- {
- case 1:System.out.println("Product: p1\tPrice: $2.5");
- break;
- case 2:System.out.println("Product: p1\tWeight: 5kg");
- break;
- case 3: int addOption; // add item option
- do
- { System.out.println("\t**********\tShopping Cart\t**********");
- System.out.println("Add item by product ID\t\t1\n"+
- "Add item by product Weight\t2\n"+
- "Bcak to customer menu\t\t0");
- addOption = input.nextInt();
- switch(addOption)
- {
- case 1:System.out.println("Add item by product ID\n\n");
- break;
- case 2:System.out.println("Add item by product Weight\n\n");
- break;
- case 0:System.out.println("Bcak to customer menu\n\n");
- break;
- }
- }while (addOption !=0);
- break;
- case 4:
- int ccAssistant;// Customer call assistant
- do{
- System.out.println("\n\n\n\nShop assisteant is coming.\nWait a moment!\n\n\n\n");
- System.out.println("\t**********\tShopping Cart Manage\t**********");
- System.out.println("Remove item\t1");
- System.out.println("Update item\t2");
- System.out.println("Cancel cart\t3");
- System.out.println("Back\t\t0");
- System.out.println("which option you want to pick?");
- ccAssistant = input.nextInt();
- switch(ccAssistant){
- case 1:
- break;
- case 2:
- break;
- case 3:
- break;
- }
- }while(ccAssistant!=0);
- break;
- case 5:System.out.println("TotalPayment is $88.88");
- break;
- }
- break;
- case 2: // Staff menu
- System.out.println("\t**********\tStaff\t**********");
- System.out.println("login as Sales Staff\t\t1");
- System.out.println("login as warehouse Staff\t2");
- System.out.println("login as manager\t\t3");
- System.out.println("which option you want to pick?");
- int stfOption = input.nextInt(); // Staff option
- switch(stfOption)
- {
- case 1:
- break;
- case 2:
- break;
- case 3: int mOption; // manager options
- do
- {
- System.out.println("\t**********\tManager\t**********");
- System.out.println("List products\t\t1");
- System.out.println("Manage products\t\t2");
- System.out.println("List Suppliers \t\t3");
- System.out.println("Manage Suppliers \t4");
- System.out.println("Back \t\t\t0");
- System.out.println("which option you want to pick?");
- mOption = input.nextInt();
- switch(mOption)
- {
- case 1: System.out.println("List products\t1");
- System.out.println(ppl.toString());
- break;
- case 2:System.out.println("Manage products\t2");
- int mmProduct; // manager manage products option
- do
- {
- System.out.println("\t**********\tManage Product\t**********");
- System.out.println("Add products\t\t1");
- System.out.println("Remove products\t\t2");
- System.out.println("Update Suppliers\t3");
- // System.out.println("Manage Suppliers \t4");
- System.out.println("Back \t\t\t0");
- System.out.println("which option you want to pick?");
- mmProduct = input.nextInt();
- switch(mmProduct)
- {
- case 1:
- System.out.println("Add products\t\t1\n");
- System.out.println(" ");
- String sID = input.nextLine();
- System.out.println("Please Enter ProductID: ");
- String ID = input.nextLine();
- System.out.println("Please Enter Product Name: ");
- String Name = input.nextLine();
- System.out.println("Please Enter Product Serial Number: ");
- int SerialNum = input.nextInt();
- System.out.println(" ");
- String ssID = input.nextLine();
- System.out.println("Please Enter Product Type W for Weight price or U for unit price: ");
- String type = input.nextLine();
- System.out.println("Please Enter Product Price: ");
- Double Price = input.nextDouble();
- System.out.println("Please Enter Product Discount: ");
- Double Discount = input.nextDouble();
- System.out.println("Please Enter Product Bulk Discount: ");
- Double BulkDiscount = input.nextDouble();
- System.out.println("How many does the customer have to buy to apply bulk discount?");
- int num = input.nextInt();
- System.out.println(" ");
- String ssSID = input.nextLine();
- System.out.println("Enter SupplierID for this product");
- String supID = input.nextLine();
- System.out.println(" ");
- String ssSSSID = input.nextLine();
- for (int i = 0; i < spl.size(); i++)
- if (spl.get(i).getSupplierID().equals(supID)){
- spID = spl.get(i);
- System.out.println(spl.get(i));
- }
- else
- System.out.println("Supplier does not exist, please add supplier first.");
- ppl.add(new Product(spID, ID,Name, type, SerialNum, Price, Discount,num, BulkDiscount));
- System.out.println(ppl.toString());
- break;
- case 2:
- break;
- case 3:
- break;
- }
- }while(mmProduct !=0);
- break;
- case 3: System.out.println("List Suppliers \t\t3");
- break;
- case 4:
- int mmSuppliers; // manager manage Suppliers
- do
- {
- System.out.println("\t**********\tManage Suppliers\t**********");
- System.out.println("Add Suppliers\t\t1");
- System.out.println("Remove Suppliers\t2");
- System.out.println("Update Suppliers\t3");
- // System.out.println("Manage Suppliers \t4");
- System.out.println("Back \t\t\t0");
- System.out.println("which option you want to pick?");
- mmSuppliers = input.nextInt();
- switch(mmSuppliers)
- {
- case 1:
- System.out.println("Add Suppliers\t\t1"); //
- System.out.println(" "); //dirty fix
- String sID = input.nextLine();
- System.out.println("Please Enter Supplier ID: \n");
- String ID = input.nextLine();
- System.out.println("Please Enter Name: \n");
- String Name = input.nextLine();
- System.out.println("Please Enter Company Name: \n");
- String Company = input.nextLine();
- System.out.println("Please Enter Email: \n");
- String Email = input.nextLine();
- System.out.println("Please Enter Phone: \n");
- String Phone = input.nextLine();
- spl.add(new Supplier(ID,Name,Company,Email,Phone));
- System.out.println("Done");
- System.out.println(spl.toString());
- break;
- case 2:
- break;
- case 3:
- break;
- }
- }while(mmSuppliers !=0);
- break;
- }
- }while(mOption !=0);
- break;
- }
- break;
- }
- }while(option != 0);
- }
- /*
- public void addProduct(){
- System.out.println("Please Enter ProductID: ");
- String ID = input.nextLine();
- System.out.println("Please Enter Product Name: ");
- String Name = input.nextLine();
- System.out.println("Please Enter Product Serial Number: ");
- int SerialNum = input.nextInt();
- System.out.println("Please Enter Product Price: ");
- Double Price = input.nextDouble();
- System.out.println("Please Enter Product Discount: ");
- Double Discount = input.nextDouble();
- System.out.println("Please Enter Product Bulk Discount: ");
- Double BulkDiscount = input.nextDouble();
- ppl.add(new Product( s1,ID,Name,SerialNum, Price, Discount, BulkDiscount));
- }
- */
- }
- /*public static void displayPrice(){
- System.out.println("Please enter ID to show price");
- String sID = input.nextLine();
- for (int i = 0; i < pp.size(); i++){
- if (ppl.get(i).getProductID().equals(sID)){
- System.out.println("The price of product ID " + sID + " is: $" + ppl.get(i).getProductPrice());
- }
- } */
- // System.out.println(ppl.toString());
- //System.out.println(spl.toString());
- //System.out.println(cpl.toString());
- //System.out.println(wal.toString());
- //System.out.println(sal.toString());
- // public static void displayDiscount(){}
- /*public List<ShoppingCart> getlist(){
- return cpl;
- } */
- //}
- //Scanner scan = new Scanner(System.in);
- //System.out.println("Supplier id?");
- //Supplier.s_SupplierID = scan.nextInt();
- //Supplier s = new Supplier();
- //Product p = new Product();
- // s.addSupplier();
- //p.addProduct();
- //Supplier s3 = new Supplier("s4","James4", "Tut", "email@email.com" , "0423400");
- //String sID =S
- //int counter = 0;
- //.updateContactName("asd");
- //ArrayList<Customer> cpl = new ArrayList<Customer>();
- //Customer c1= new Customer("c1" , "DASD", "ASDSADASD", 412331, 'A',"1/1/1" ,"ADSAD", 5);
- //Customer c1 = new Customer();
- //Customer c2 = new Customer();
- //Customer c3 = new Customer();
- ///System.out.println(c3.getIndicator());
- //Product p2 = new Product (s1, "p2" , "basa", 141, 5.5, 51 , 21 , 0.0, 0.0);
- //Payment p = new Payment();
- //System.out.println(p.caculatePoint(sh1.CaculateTotalPrice()));
- //ppl.add( s1, "p2" , "basa", 141, 5.5, 51 , 21 , 0.0, 0.0 );
- //ppl.add(p2);
- //ShoppingCart sh1 = new ShoppingCart (c1, p1, 1, 2 , 2.0 );
- //sh1.cart.add(sh1);
- //System.out.println(sh1.toString());
- //System.out.println(c1.toString());
- //Supplier s2 = new Supplier("s2","James2", "Tut", "email@email.com" , "0423400");
- //spl.add(s2);
- //Product p2 = new Product ("p2" , "baana" , 123 , 5.0 , 5 , 15, 0.0, 0.0);
- //ppl.add(p2);
- //System.out.println(c1.toString());
- //double price = c1.getPrice();
- //System.out.println(price);
- //Product p3 = new Product ("p3" , "baana" , 123 , 5.0 , 5 , 15, 0.0, 0.0);
- //ppl.add(p3);
- //System.out.println(ppl.toString());
- //Supplier s3 = new Supplier("s3","James3", "Tut", "email@email.com" , "0423400"); //have to add supplier first before adding product
- //spl.add(s3);
- //System.out.println(ppl.toString());
- //p3.updateProductDiscount(2.5);
- //System.out.println(ppl.toString());
- //System.out.println(spl.toString());
- //s1.updateCompany("qewq");
- //Supplier s2 = new Supplier (2, "sda", "DAS" , "ASDASDSA" , 01232131);
- //spl.add(s2);
- //spl.remove(s1);
- //System.out.println(spl.toString());
- //System.out.println(py1.getAmount(sh1));
- //System.out.println(py1.toString());
- /*public static void main(String[] args) { // testing add on Product
- ArrayList<Product> ppl = new ArrayList<Product>();
- Product p1 = new Product (1, "jea" , 123, 1.54 , 5 , "DAS" , 2 , 0.0 , 0.0);
- ppl.add(p1);
- System.out.println(ppl.toString());
- } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement