-
Notifications
You must be signed in to change notification settings - Fork 2.4k
/
RestaurantManagementDemo.java
49 lines (39 loc) · 1.98 KB
/
RestaurantManagementDemo.java
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
package restaurantmanagementsystem;
import restaurantmanagementsystem.payment.Payment;
import restaurantmanagementsystem.payment.PaymentMethod;
import restaurantmanagementsystem.payment.PaymentStatus;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.List;
public class RestaurantManagementDemo {
public static void run() {
Restaurant restaurant = Restaurant.getInstance();
// Add menu items
restaurant.addMenuItem(new MenuItem(1, "Burger", "Delicious burger", 9.99, true));
restaurant.addMenuItem(new MenuItem(2, "Pizza", "Cheesy pizza", 12.99, true));
restaurant.addMenuItem(new MenuItem(3, "Salad", "Fresh salad", 7.99, true));
// Place an order
Order order = new Order(1, Arrays.asList(new MenuItem(1, "Burger", "Delicious burger", 9.99, true),
new MenuItem(3, "Salad", "Fresh salad", 7.99, true)), 17.98, OrderStatus.PENDING, new Timestamp(System.currentTimeMillis()));
restaurant.placeOrder(order);
// Make a reservation
Reservation reservation = new Reservation(1, "John Doe", "1234567890", 4, new Timestamp(System.currentTimeMillis()));
restaurant.makeReservation(reservation);
// Process a payment
Payment payment = new Payment(1, 17.98, PaymentMethod.CREDIT_CARD, PaymentStatus.PENDING);
restaurant.processPayment(payment);
// Update order status
restaurant.updateOrderStatus(1, OrderStatus.PREPARING);
restaurant.updateOrderStatus(1, OrderStatus.READY);
restaurant.updateOrderStatus(1, OrderStatus.COMPLETED);
// Add staff
restaurant.addStaff(new Staff(1, "Alice", "Manager", "9876543210"));
restaurant.addStaff(new Staff(2, "Bob", "Chef", "5432109876"));
// Get menu
List<MenuItem> menu = restaurant.getMenu();
System.out.println("Menu:");
for (MenuItem item : menu) {
System.out.println(item.getName() + " - $" + item.getPrice());
}
}
}