-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrder.java
More file actions
22 lines (19 loc) · 739 Bytes
/
Copy pathOrder.java
File metadata and controls
22 lines (19 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import java.util.HashMap;
public class Order {
private HashMap<String, Integer> itemsOrdered = new HashMap<>();
public void addItem(String item, int quantity) {
itemsOrdered.put(item, quantity);
}
public void showOrder() {
int total = 0;
System.out.println("\n🧾 Your Order Summary:");
for (String item : itemsOrdered.keySet()) {
int qty = itemsOrdered.get(item);
int price = Menu.getMenuItems().get(item);
System.out.println(item + " x" + qty + " = ₹" + (price * qty));
total += price * qty;
}
System.out.println("Total Bill: ₹" + total);
System.out.println("\n✅ Payment simulated successfully!\n");
}
}