Advertisement
Guest User

Untitled

a guest
May 14th, 2017
549
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.25 KB | None | 0 0
  1. package main;
  2.  
  3. import java.util.*;
  4.  
  5.  
  6.  
  7. public class main {
  8.  
  9.  
  10.  
  11. Scanner input = new Scanner(System.in);
  12.  
  13.  
  14. public static void main(String[] args) { // testing add/update/remove on supplier
  15.  
  16. Scanner input = new Scanner(System.in);
  17.  
  18. ArrayList<Supplier> spl = new ArrayList<Supplier>();
  19. ArrayList<Cart> cpl = new ArrayList<ShoppingCart>();
  20. ArrayList<Customer> cul = new ArrayList<Customer>();
  21. ArrayList<Warehouse> wal = new ArrayList<Warehouse>();
  22. ArrayList<Sales> sal = new ArrayList<Sales>();
  23. ArrayList<Product> ppl = new ArrayList<Product>();
  24. ArrayList<Manager> mspl = new ArrayList<Manager>();
  25. ArrayList<SalesStaff> sspl = new ArrayList<SalesStaff>();
  26. ArrayList<WarehouseStaff> wspl = new ArrayList<WarehouseStaff>();
  27.  
  28. Supplier s1 = new Supplier("s1", "dasd", "asdsa", "asdsa", "asdsa");
  29. spl.add(s1);
  30.  
  31.  
  32.  
  33. /*
  34. Manager m1 = new Manager("m1","a","a","a",1,"a",2,"a");
  35. mspl.add(m1);
  36.  
  37.  
  38. SalesStaff ss1 = new SalesStaff("ss1","a","a","a",1,"a",2,"a");
  39. sspl.add(ss1);
  40.  
  41. WarehouseStaff ws1 = new WarehouseStaff("ws1","a","a","a",1,"a",2,"a");
  42. wspl.add(ws1);
  43.  
  44. System.out.println(m1.displayAll());
  45. System.out.println(ss1.displayAll());
  46. System.out.println(ws1.displayAll());
  47.  
  48.  
  49.  
  50.  
  51. Customer c1 = new Customer("John", "c1" , "125 therry st", 1231312, 'M', "1/1/1", "email@email.com", 0.0);
  52. cul.add(c1);
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62. Supplier s1 = new Supplier("s1","James", "Tut", "email@email.com" , "0423400");
  63.  
  64.  
  65. Supplier s2 = new Supplier("s3","James3", "Tut", "email@email.com" , "0423400");
  66.  
  67.  
  68. spl.add(s1);
  69. spl.add(s2);
  70.  
  71.  
  72.  
  73.  
  74.  
  75. //Product p1 = new Product (s1 ,"p1" , "baana" , 123 , 5.0 , 0.0, 5, 0.0);
  76. //Product p2 = new Product (s2, "p2" , "Apple", 124, 12.0, 0.0, 6, 0.0);
  77.  
  78.  
  79.  
  80. ppl.add(p1);
  81. ppl.add(p2);
  82.  
  83. Warehouse wa1 = new Warehouse(p1, 100, 30, 100);
  84. wal.add(wa1);
  85.  
  86. ArrayList <Payment> pyl = new ArrayList<Payment>();
  87.  
  88. // ShoppingCart sh1 = new ShoppingCart(c1, p1, "ca1", 71 , 5.0);
  89.  
  90.  
  91.  
  92. //cpl.add(sh1);
  93.  
  94. s1.updateCompany("rae");
  95.  
  96.  
  97. //Payment py1 = new Payment("py1", sh1);
  98.  
  99. //pyl.add(py1);
  100.  
  101. //wa1.qtyAfter(py1);
  102. wa1.reorder();
  103.  
  104. //Sales sa1 = new Sales("sa1",p1,wa1, sh1);
  105. //sal.add(sa1);
  106.  
  107. /*
  108. * option 1 as customer
  109. * option 1.1 as check price
  110. * System.out.println("Please enter ID to show discount");
  111. String sID = input.nextLine();
  112. c1.searchProductPrice(ppl, sID);
  113.  
  114.  
  115. //ss1.removeItems(cpl, sh1);
  116. System.out.println(cpl.toString() + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
  117.  
  118. System.out.println("+++++++++++++++++++++++++++++++++");
  119. m1.updateProductPrice(ppl, p1,10.00 );
  120. System.out.println("+++++++++++++++++++++++++++++++++");
  121.  
  122. System.out.println(ppl.toString());
  123. ws1.updateStock(wa1);
  124. System.out.println("Please enter ID to show price");
  125. String sID = input.nextLine();
  126. c1.searchProductPrice(ppl, sID);
  127.  
  128. System.out.println("Please enter ID to show discount");
  129. String dID = input.nextLine();
  130. c1.searchProductDiscount(ppl, dID);
  131.  
  132. System.out.println(wa1.toString()); */
  133.  
  134. //Supplier s1 = new Supplier("s1","James", "Tut", "email@email.com" , "0423400");
  135. spl.add(s1);
  136. int option;
  137. Supplier spID = new Supplier();
  138. do
  139. {
  140. System.out.println("\t**********\tMenu\t**********");
  141. System.out.println("login as Customer\t1\n" +
  142. "login as Staff\t\t2\n" +
  143. "exit\t\t0");
  144. System.out.println("which option you want to pick?");
  145.  
  146. option = input.nextInt();
  147. switch(option)
  148. {
  149. case 1: // Customer Menu
  150. System.out.println("\t**********\tCustomer\t**********");
  151. System.out.println("Check product price\t1");
  152. System.out.println("Check product weight\t2");
  153. System.out.println("Add Item\t\t3");
  154. System.out.println("Call assistant\t\t4");
  155. System.out.println("Pay\t\t\t5");
  156. System.out.println("which option you want to pick?");
  157.  
  158. int cusOption = input.nextInt(); // customer option
  159. switch(cusOption)
  160. {
  161. case 1:System.out.println("Product: p1\tPrice: $2.5");
  162. break;
  163. case 2:System.out.println("Product: p1\tWeight: 5kg");
  164. break;
  165. case 3: int addOption; // add item option
  166. do
  167. { System.out.println("\t**********\tShopping Cart\t**********");
  168. System.out.println("Add item by product ID\t\t1\n"+
  169. "Add item by product Weight\t2\n"+
  170. "Bcak to customer menu\t\t0");
  171. addOption = input.nextInt();
  172. switch(addOption)
  173. {
  174. case 1:System.out.println("Add item by product ID\n\n");
  175. break;
  176. case 2:System.out.println("Add item by product Weight\n\n");
  177. break;
  178. case 0:System.out.println("Bcak to customer menu\n\n");
  179. break;
  180. }
  181. }while (addOption !=0);
  182.  
  183. break;
  184. case 4:
  185. int ccAssistant;// Customer call assistant
  186. do{
  187. System.out.println("\n\n\n\nShop assisteant is coming.\nWait a moment!\n\n\n\n");
  188.  
  189. System.out.println("\t**********\tShopping Cart Manage\t**********");
  190. System.out.println("Remove item\t1");
  191. System.out.println("Update item\t2");
  192. System.out.println("Cancel cart\t3");
  193. System.out.println("Back\t\t0");
  194. System.out.println("which option you want to pick?");
  195. ccAssistant = input.nextInt();
  196. switch(ccAssistant){
  197. case 1:
  198. break;
  199. case 2:
  200. break;
  201. case 3:
  202. break;
  203. }
  204. }while(ccAssistant!=0);
  205. break;
  206. case 5:System.out.println("TotalPayment is $88.88");
  207. break;
  208. }
  209. break;
  210. case 2: // Staff menu
  211. System.out.println("\t**********\tStaff\t**********");
  212. System.out.println("login as Sales Staff\t\t1");
  213. System.out.println("login as warehouse Staff\t2");
  214. System.out.println("login as manager\t\t3");
  215. System.out.println("which option you want to pick?");
  216. int stfOption = input.nextInt(); // Staff option
  217. switch(stfOption)
  218. {
  219. case 1:
  220. break;
  221. case 2:
  222. break;
  223. case 3: int mOption; // manager options
  224.  
  225. do
  226. {
  227. System.out.println("\t**********\tManager\t**********");
  228. System.out.println("List products\t\t1");
  229. System.out.println("Manage products\t\t2");
  230. System.out.println("List Suppliers \t\t3");
  231. System.out.println("Manage Suppliers \t4");
  232. System.out.println("Back \t\t\t0");
  233. System.out.println("which option you want to pick?");
  234. mOption = input.nextInt();
  235.  
  236. switch(mOption)
  237. {
  238. case 1: System.out.println("List products\t1");
  239. System.out.println(ppl.toString());
  240. break;
  241. case 2:System.out.println("Manage products\t2");
  242. int mmProduct; // manager manage products option
  243. do
  244. {
  245. System.out.println("\t**********\tManage Product\t**********");
  246. System.out.println("Add products\t\t1");
  247. System.out.println("Remove products\t\t2");
  248. System.out.println("Update Suppliers\t3");
  249. // System.out.println("Manage Suppliers \t4");
  250. System.out.println("Back \t\t\t0");
  251. System.out.println("which option you want to pick?");
  252. mmProduct = input.nextInt();
  253.  
  254. switch(mmProduct)
  255. {
  256. case 1:
  257.  
  258. System.out.println("Add products\t\t1\n");
  259.  
  260. System.out.println(" ");
  261. String sID = input.nextLine();
  262.  
  263. System.out.println("Please Enter ProductID: ");
  264. String ID = input.nextLine();
  265. System.out.println("Please Enter Product Name: ");
  266. String Name = input.nextLine();
  267. System.out.println("Please Enter Product Serial Number: ");
  268. int SerialNum = input.nextInt();
  269. System.out.println(" ");
  270. String ssID = input.nextLine();
  271.  
  272. System.out.println("Please Enter Product Type W for Weight price or U for unit price: ");
  273. String type = input.nextLine();
  274. System.out.println("Please Enter Product Price: ");
  275. Double Price = input.nextDouble();
  276. System.out.println("Please Enter Product Discount: ");
  277. Double Discount = input.nextDouble();
  278. System.out.println("Please Enter Product Bulk Discount: ");
  279. Double BulkDiscount = input.nextDouble();
  280. System.out.println("How many does the customer have to buy to apply bulk discount?");
  281. int num = input.nextInt();
  282.  
  283. System.out.println(" ");
  284. String ssSID = input.nextLine();
  285.  
  286.  
  287. System.out.println("Enter SupplierID for this product");
  288. String supID = input.nextLine();
  289.  
  290. System.out.println(" ");
  291. String ssSSSID = input.nextLine();
  292.  
  293. for (int i = 0; i < spl.size(); i++)
  294.  
  295. if (spl.get(i).getSupplierID().equals(supID)){
  296.  
  297. spID = spl.get(i);
  298. System.out.println(spl.get(i));
  299.  
  300. }
  301. else
  302. System.out.println("Supplier does not exist, please add supplier first.");
  303.  
  304.  
  305. ppl.add(new Product(spID, ID,Name, type, SerialNum, Price, Discount,num, BulkDiscount));
  306. System.out.println(ppl.toString());
  307. break;
  308. case 2:
  309. break;
  310. case 3:
  311. break;
  312. }
  313. }while(mmProduct !=0);
  314. break;
  315. case 3: System.out.println("List Suppliers \t\t3");
  316. break;
  317. case 4:
  318. int mmSuppliers; // manager manage Suppliers
  319.  
  320. do
  321. {
  322. System.out.println("\t**********\tManage Suppliers\t**********");
  323. System.out.println("Add Suppliers\t\t1");
  324. System.out.println("Remove Suppliers\t2");
  325. System.out.println("Update Suppliers\t3");
  326. // System.out.println("Manage Suppliers \t4");
  327. System.out.println("Back \t\t\t0");
  328. System.out.println("which option you want to pick?");
  329. mmSuppliers = input.nextInt();
  330. switch(mmSuppliers)
  331. {
  332. case 1:
  333.  
  334. System.out.println("Add Suppliers\t\t1"); //
  335. System.out.println(" "); //dirty fix
  336. String sID = input.nextLine();
  337. System.out.println("Please Enter Supplier ID: \n");
  338. String ID = input.nextLine();
  339. System.out.println("Please Enter Name: \n");
  340. String Name = input.nextLine();
  341. System.out.println("Please Enter Company Name: \n");
  342. String Company = input.nextLine();
  343. System.out.println("Please Enter Email: \n");
  344. String Email = input.nextLine();
  345. System.out.println("Please Enter Phone: \n");
  346. String Phone = input.nextLine();
  347. spl.add(new Supplier(ID,Name,Company,Email,Phone));
  348. System.out.println("Done");
  349. System.out.println(spl.toString());
  350. break;
  351. case 2:
  352. break;
  353. case 3:
  354. break;
  355. }
  356. }while(mmSuppliers !=0);
  357. break;
  358.  
  359. }
  360.  
  361. }while(mOption !=0);
  362. break;
  363. }
  364.  
  365. break;
  366.  
  367. }
  368. }while(option != 0);
  369.  
  370. }
  371.  
  372. /*
  373. public void addProduct(){
  374. System.out.println("Please Enter ProductID: ");
  375. String ID = input.nextLine();
  376. System.out.println("Please Enter Product Name: ");
  377. String Name = input.nextLine();
  378. System.out.println("Please Enter Product Serial Number: ");
  379. int SerialNum = input.nextInt();
  380. System.out.println("Please Enter Product Price: ");
  381. Double Price = input.nextDouble();
  382. System.out.println("Please Enter Product Discount: ");
  383. Double Discount = input.nextDouble();
  384. System.out.println("Please Enter Product Bulk Discount: ");
  385. Double BulkDiscount = input.nextDouble();
  386. ppl.add(new Product( s1,ID,Name,SerialNum, Price, Discount, BulkDiscount));
  387. }
  388. */
  389. }
  390.  
  391.  
  392.  
  393. /*public static void displayPrice(){
  394. System.out.println("Please enter ID to show price");
  395. String sID = input.nextLine();
  396. for (int i = 0; i < pp.size(); i++){
  397.  
  398. if (ppl.get(i).getProductID().equals(sID)){
  399. System.out.println("The price of product ID " + sID + " is: $" + ppl.get(i).getProductPrice());
  400.  
  401.  
  402. }
  403. } */
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414. // System.out.println(ppl.toString());
  415.  
  416. //System.out.println(spl.toString());
  417. //System.out.println(cpl.toString());
  418. //System.out.println(wal.toString());
  419. //System.out.println(sal.toString());
  420.  
  421.  
  422.  
  423. // public static void displayDiscount(){}
  424.  
  425.  
  426.  
  427.  
  428.  
  429.  
  430. /*public List<ShoppingCart> getlist(){
  431. return cpl;
  432. } */
  433. //}
  434.  
  435. //Scanner scan = new Scanner(System.in);
  436. //System.out.println("Supplier id?");
  437. //Supplier.s_SupplierID = scan.nextInt();
  438. //Supplier s = new Supplier();
  439. //Product p = new Product();
  440.  
  441. // s.addSupplier();
  442. //p.addProduct();
  443.  
  444. //Supplier s3 = new Supplier("s4","James4", "Tut", "email@email.com" , "0423400");
  445.  
  446. //String sID =S
  447.  
  448. //int counter = 0;
  449.  
  450. //.updateContactName("asd");
  451.  
  452. //ArrayList<Customer> cpl = new ArrayList<Customer>();
  453.  
  454.  
  455.  
  456. //Customer c1= new Customer("c1" , "DASD", "ASDSADASD", 412331, 'A',"1/1/1" ,"ADSAD", 5);
  457. //Customer c1 = new Customer();
  458. //Customer c2 = new Customer();
  459. //Customer c3 = new Customer();
  460.  
  461.  
  462. ///System.out.println(c3.getIndicator());
  463.  
  464. //Product p2 = new Product (s1, "p2" , "basa", 141, 5.5, 51 , 21 , 0.0, 0.0);
  465.  
  466. //Payment p = new Payment();
  467.  
  468. //System.out.println(p.caculatePoint(sh1.CaculateTotalPrice()));
  469.  
  470. //ppl.add( s1, "p2" , "basa", 141, 5.5, 51 , 21 , 0.0, 0.0 );
  471. //ppl.add(p2);
  472.  
  473. //ShoppingCart sh1 = new ShoppingCart (c1, p1, 1, 2 , 2.0 );
  474. //sh1.cart.add(sh1);
  475.  
  476. //System.out.println(sh1.toString());
  477. //System.out.println(c1.toString());
  478.  
  479. //Supplier s2 = new Supplier("s2","James2", "Tut", "email@email.com" , "0423400");
  480. //spl.add(s2);
  481.  
  482. //Product p2 = new Product ("p2" , "baana" , 123 , 5.0 , 5 , 15, 0.0, 0.0);
  483. //ppl.add(p2);
  484.  
  485. //System.out.println(c1.toString());
  486.  
  487. //double price = c1.getPrice();
  488. //System.out.println(price);
  489.  
  490. //Product p3 = new Product ("p3" , "baana" , 123 , 5.0 , 5 , 15, 0.0, 0.0);
  491. //ppl.add(p3);
  492.  
  493. //System.out.println(ppl.toString());
  494.  
  495. //Supplier s3 = new Supplier("s3","James3", "Tut", "email@email.com" , "0423400"); //have to add supplier first before adding product
  496. //spl.add(s3);
  497.  
  498. //System.out.println(ppl.toString());
  499.  
  500. //p3.updateProductDiscount(2.5);
  501.  
  502. //System.out.println(ppl.toString());
  503. //System.out.println(spl.toString());
  504.  
  505.  
  506. //s1.updateCompany("qewq");
  507. //Supplier s2 = new Supplier (2, "sda", "DAS" , "ASDASDSA" , 01232131);
  508. //spl.add(s2);
  509.  
  510. //spl.remove(s1);
  511. //System.out.println(spl.toString());
  512.  
  513.  
  514. //System.out.println(py1.getAmount(sh1));
  515. //System.out.println(py1.toString());
  516.  
  517. /*public static void main(String[] args) { // testing add on Product
  518. ArrayList<Product> ppl = new ArrayList<Product>();
  519. Product p1 = new Product (1, "jea" , 123, 1.54 , 5 , "DAS" , 2 , 0.0 , 0.0);
  520. ppl.add(p1);
  521. System.out.println(ppl.toString());
  522. } */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement