Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void ShowOrderUI(Order order) {
- if (order == null) {
- return;
- }
- System.out.println("-- Order " + order.getOrderID() + " --");
- System.out.println("1. Add Item");
- System.out.println("2. Delete Item");
- System.out.println("3. View Order");
- System.out.println("4. Print Invoice");
- //menuOption = sc.nextInt();
- boolean cont = true;
- switch (sc.next().charAt(0)) {
- case '1':
- //iterate
- //add(menuItem);
- break;
- case '2':
- do {
- if(order.itemListIsEmpty() && order.setListIsEmpty()) {
- System.out.println("Order is empty - Unable delete item");
- cont = false;
- }
- else {
- displayOrder(order);
- removeOrderItemUI(order);
- if(order.itemListIsEmpty() && order.setListIsEmpty()) {
- System.out.println("Order is empty - Unable delete item");
- cont = false;
- }
- else {
- System.out.println("Do you want to remove more items? (Y/N)");
- char c = sc.next().charAt(0);
- if (c == 'N' || c == 'n') {
- cont = false;
- }
- else if (c == 'Y' || c == 'y') {
- cont = true;
- }
- }
- }
- }while(cont);
- break;
- case '3':
- displayOrder(order);
- break;
- case '4':
- if(order.itemListIsEmpty() && order.setListIsEmpty()) {
- System.out.println("Order is empty - Unable to Print Invoice");
- }
- else {
- order.generateInvoice();
- }
- break;
- default:
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement