
Contents
Application Analysis and Design – UML Design and Analysis Assignment
Question 1
Read the system requirements of the Gruberoo application in the Appendix and submit answers to the following:
Question 1a
Formulate a use case diagram to depict the Gruberoo application design.
Your use case diagram should show the actors, the use cases and their relationships.
Question 1b
The following is an extract of the requirements of the Gruberoo application:
“The Gruberoo application is an online food delivery service that connects consumers with local restaurants and retailers. It allows customers to order food through its application for quick, on-demand delivery, typically within 30 minutes. It aims to transform the way people shop and eat by bringing local options directly to consumers’ doorsteps.”
Analyse the above extract to identify and explain any TWO (2) ambiguous, incorrect, incomplete or inconsistent inadequacies of the system design as compared to the information given in the Appendix.
Note that in your answers, you are not to use imagination to add anything not mentioned in the Appendix. Further, do not include general commentaries in your answer.
Question 2
Develop a structural model for the Gruberoo application design by submitting your answers to the following:
Question 2a
Complete the class description by identifying classes, their attributes and any hierarchical relationship(s) that would be required for the application.
Question 2b
Appraise the associations among the classes and hierarchical relationship(s) that would be required for the application. Construct the class association diagram in UML as your answer. Ensure that you do not include any derived or redundant association in your diagram.
Question 3
Analyse the requirements for the Gruberoo application and derive an updated class diagram which lists all the food items in an order. Part of the diagram is show in Figure Q3 below.
Note that this may not be applicable to Question 2 above.
Assume that the Order class has the attribute orderId and the FoodItem class has the attributes foodName and price. Consider the following walkthrough that illustrates how the application retrieves the foodName and price of all food items associated with an order:
Objective: To retrieve a list of food name and price associated with an order Given: an order identifier, orderId
- Locate the instance, anOrder, of Order with the orderId, linked to the orchestrating object via hasOrders.
- Retrieve all instances of the OrderedFoodItem objects, linked to
anOrder via consistsOf.
- For each instance of the OrderedFoodItem object,
anOrderedFoodItem:
- Retrieve the FoodItem object, aFoodItem, linked to
anOrderedFoodItem via isA.
- Get the attributes foodName and price of aFoodItem
- Add foodName and price to a list
- Return the list
Question 3a
Develop the dynamic model for the application function, by drawing the sequence diagram for the walkthrough where the food name and price of all food items associated with the order are returned.
Question 3b
Using the Python programming language, implement the method that represents a message that is sent by another object to the object of the following classes in the sequence diagram of Question 3(a):
- the orchestrating class
- the Order class
Question 4
Demonstrate the construction of a component in the Gruberoo application by submitting your answers to the following:
Question 4a
Identify the different states of the Order object.
Question 4b
Draw the state diagram for the Order object as it passes through the system.
Question 5
Demonstrate the application of the observer pattern in the Gruberoo application by submitting your answers to the following:
Question 5a
Develop a structural model of the system that uses the observer pattern by constructing the class association diagram that allows a customer to register interest in being notified of new special offers from chosen restaurants. This notification uses the “push” method.
Question 5b
Using the Python programming language, implement the concrete classes for the structural model in Question 5(a).
Appendix 1:
Gruberro is a food delivery application (app) that allows customers to order food from restaurants and have their order delivered to a specified address. Restaurant personnel may sign up with the restaurant name and email address. A unique restaurant ID will be automatically assigned by the app to identify the restaurant. The restaurant personnel can then specify the items in their menu, identified by menu names, that are available for delivery. They can also implement special offers, such as a public holiday discounts or a set meal at an attractive price.
Customers who have signed up to the app with their name and email address, can place an order with any participating restaurant. The app offers robust ways to search for restaurants and food items. Each food item has a unique name, description and price. Once a suitable restaurant is chosen, the customer can create an order consisting of multiple food items and specify a delivery date, time and address. When the order is submitted, a unique order ID is associated with the order and the date and time of the order are recorded.
The customer will then pay for the order using their preferred payment method (e.g., credit card, PayPal or cash on delivery). Upon successful payment, the app will notify the restaurant, which would then confirm or reject the order. If the order is rejected, Gruberoo will refund the customer’s payment. If the order is confirmed, the restaurant will prepare the order shortly before delivery.
The customer can still cancel the order after it is confirmed by the restaurant, but once preparation has started, the customer can no longer cancel the order. The restaurant will refund the customer’s payment for each successfully cancelled order. Rejected or cancelled orders will then be deleted from the app. The details of successfully delivered orders will be stored in the system for 1 year, after which they will be archived and removed.
Gruberoo is constantly trying to introduce new and useful features to its users. Some proposed features include:
- Dividing restaurant menus into sub-menus.
- The ability to customize individual food items. (e.g., extra chilli, changing fries to onion rings for an additional cost, etc.) when placing orders, which may affect the price;
- Allowing customers to opt in to notifications for new special offers from chosen restaurants;
- Enabling customers to save a favourite order that can be placed with one click.
Expert Answers on Above Python Programming Questions
Use case diagram
The diagram is included in the appendix section and the actors are customer, restaurant personnel and payment system. The use cases are the sign up/login, search restaurant/ food items, placing orders, making payment, cancelling order, receiving notification, managing menu and confirming/ rejecting order.
Relationships
The customer places the order and makes payment. The restaurant confirms or rejects the order and the system informs the customer and restaurant.
Inadequacies
The inadequacies include incomplete and ambiguous orders whereby instances like quick delivery within 30 minutes are stated but not supported, or retailers are specified clearly but only restaurants are defined creating inconsistencies.
Classes and attributes
The main classes are the customer with name and email, restaurant with restaurant ID, menu with menu name, food item with food name, description and price, order with order ID, date, time and delivery address, and payment with method and status.
Class Association
Customers place order, and order consists of ordered food item, ordered food item refers to food item, restaurant owns menu, menu contains food item, and order associated with payment.
Sequence diagram
The flow indicates orchestrator orders, and the food item ordered is retrieved. The loop each item is ordered food item, get food name and price. Return list to orchestrator.
Python methods
class Order: def __init__(self, orderId, items): self.orderId = orderId self.items = items def get_items(self): return self.items class Orchestrator: def get_food_details(self, order): result = [] for ordered_item in order.get_items(): food = ordered_item.get_food_item() result.append((food.foodName, food.price)) return resultOrder States
The order states are defined as created, paid, confirmed, rejected, preparing, delivered, cancelled and archived.
State diagram flow – the flow is stated as created – paid – confirmed – preparing – delivered – archived. And it can also be rejected – deleted or cancelled – refunded – deleted.
Observer pattern
The classes are subject – restaurant, observer – customer, concrete subject – restaurant offers, concrete observer – subscribed customer.
Python implementation
class Restaurant: def __init__(self): self.subscribers = [] def register(self, customer): self.subscribers.append(customer) def notify(self, offer): for sub in self.subscribers: sub.update(offer) class Customer: def update(self, offer): print(f”New offer received: {offer}”)| Disclaimer: This answer is a model for study and reference purposes only. Please do not submit it as your own work. |
Want a Full Worked Out Answer with References?
Assignments based on Python Programming require technical skills and knowledge in completing such assignments in a perfect way. If you need professional assistance from a programming expert, visit our assignment help services page in Singapore to get access to professional experts.

