-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
117 lines (84 loc) · 3.45 KB
/
Copy pathMain.java
File metadata and controls
117 lines (84 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package src;
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("===== FOODHUB : ONLINE FOOD ORDERING SYSTEM =====");
System.out.print("Enter your name: ");
String name = sc.nextLine();
System.out.print("Enter phone: ");
String phone = sc.nextLine();
System.out.print("Enter address: ");
String address = sc.nextLine();
Customer customer = new Customer(name, phone, address);
Menu menu = new Menu();
Order order = new Order();
int choice;
do {
System.out.println("\n1. Show Menu");
System.out.println("2. Add Item");
System.out.println("3. Remove Item");
System.out.println("4. View Cart");
System.out.println("5. Get Suggestions (Budget)");
System.out.println("6. Checkout");
System.out.println("7. View Orders (Admin)");
System.out.println("0. Exit");
System.out.print("Enter choice: ");
choice = sc.nextInt();
switch (choice) {
case 1:
menu.showMenu();
break;
case 2:
System.out.print("Enter item id: ");
FoodItem item = menu.getItemById(sc.nextInt());
if (item != null) {
order.addItem(item);
} else {
System.out.println("Invalid item!");
}
break;
case 3:
System.out.print("Enter item id: ");
order.removeItem(sc.nextInt());
break;
case 4:
order.showCart();
break;
case 5:
System.out.print("Enter your budget: ");
double budget = sc.nextDouble();
menu.suggestItems(budget);
menu.suggestCombo(budget);
break;
case 6:
sc.nextLine();
System.out.print("Are you premium customer? (yes/no): ");
String type = sc.nextLine();
if (type.equalsIgnoreCase("yes")) {
customer = new PremiumCustomer(name, phone, address);
}
order.orderSummary(customer);
break;
case 7:
sc.nextLine();
System.out.print("Enter admin username: ");
String user = sc.nextLine();
System.out.print("Enter password: ");
String pass = sc.nextLine();
if (user.equals("admin") && pass.equals("1234")) {
ViewOrders.showOrders();
} else {
System.out.println("Access Denied!");
}
break;
case 0:
System.out.println("Thank you!");
break;
default:
System.out.println("Invalid choice!");
}
} while (choice != 0);
sc.close();
}
}