Java Ording console app
Java Ording console app
You are tasked with designing a system for a food delivery application. The system should allow
users to browse a menu, place orders, and track their delivery status.
The system will involve the following classes, each abstracting a specific part of the food
ordering process:
● Attributes:
○ name (string)
○ price (float)
○ description (string)
● Methods:
○ get_details() (abstract method to display item details)
● Attributes (Specific):
○ FoodItem: ingredients (list of strings)
○ DrinkItem: size (string, e.g., "Small", "Medium", "Large")
● Methods:
○ Override get_details() to include specific attributes.
3. Class: Order
● Attributes:
○ order_id (int)
○ items (list of MenuItem objects)
○ status (string, e.g., "Pending", "Preparing", "Out for Delivery", "Delivered")
● Methods:
○ add_item(menu_item) - Add a menu item to the order.
○ remove_item(menu_item) - Remove a menu item.
○ calculate_total() - Calculate the total cost of the order.
○ update_status(new_status) - Update the order status.
4. Class: User
● Attributes:
○ user_id (int)
○ name (string)
○ order_history (list of Order objects)
● Methods:
○ place_order(order) - Adds an order to the user’s order history.
○ view_order_history() - Display all previous orders.
Class: Restaurant
● Attributes:
○ menu (list of MenuItem objects)
○ orders (list of Order objects)
● Methods:
○ add_to_menu(item) - Add an item to the menu.
○ view_menu() - Display the menu.
○ process_order(order) - Updates order status.
—-----
Answer here: :)