Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. public static void ShowOrderUI(Order order) {
  2. if (order == null) {
  3. return;
  4. }
  5.  
  6. System.out.println("-- Order " + order.getOrderID() + " --");
  7. System.out.println("1. Add Item");
  8. System.out.println("2. Delete Item");
  9. System.out.println("3. View Order");
  10. System.out.println("4. Print Invoice");
  11.  
  12. //menuOption = sc.nextInt();
  13. boolean cont = true;
  14. switch (sc.next().charAt(0)) {
  15. case '1':
  16. //iterate
  17. //add(menuItem);
  18. break;
  19. case '2':
  20. do {
  21. if(order.itemListIsEmpty() && order.setListIsEmpty()) {
  22. System.out.println("Order is empty - Unable delete item");
  23. cont = false;
  24. }
  25. else {
  26. displayOrder(order);
  27. removeOrderItemUI(order);
  28.  
  29. if(order.itemListIsEmpty() && order.setListIsEmpty()) {
  30. System.out.println("Order is empty - Unable delete item");
  31. cont = false;
  32. }
  33. else {
  34. System.out.println("Do you want to remove more items? (Y/N)");
  35. char c = sc.next().charAt(0);
  36. if (c == 'N' || c == 'n') {
  37. cont = false;
  38. }
  39. else if (c == 'Y' || c == 'y') {
  40. cont = true;
  41. }
  42. }
  43. }
  44. }while(cont);
  45. break;
  46. case '3':
  47. displayOrder(order);
  48. break;
  49. case '4':
  50. if(order.itemListIsEmpty() && order.setListIsEmpty()) {
  51. System.out.println("Order is empty - Unable to Print Invoice");
  52. }
  53. else {
  54. order.generateInvoice();
  55. }
  56. break;
  57. default:
  58. break;
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement