Update / load inventory
Customer purchase item(s)
Accept payment (card, cash and coin)
Check low stock / functionality and call technician
Vending Machine:
checkInventories():
return inventory.checkInventories () -> invent_dict
getItem(string itemName):
price = inventory.getPrice(item)
acceptPayment(price)
updateInventory(item, quantity)
loadItem(string itemName, int quantity):
updateInventory(item, quatity + getInventory(item))
updatePrice(string itemName, int price):
setPrice(itemName, price)
InventoryManager:
inventory_dict {string itemName: int quantity}
price_dict {string itemName: int quantity}
addInventory (string item) ->
checkInventories () -> invent_dict
checkInventory(item) -> int quantity
getPrice(item)
setPrice(item, price)
updateInventory (item, quatity) -> [string item, int quatity]
deleteInventory(item) -> [string item, int quatity]
class Payment:
acceptPayment()
class coinProcessor(Payment):
acceptPayment()
class cardProcessor(Payment):
acceptPayment()
class cashProcessor(Payment):
acceptPayment
class Alerts:
def notify(status)
class PaymentAlert(Alerts):
def notify(self, status):
class RestockAlert(Alerts):
def notify(self, status):
class MaintainanceAlert(Alerts):
Determine how these objects will interact with each other to fulfill the use cases...
Payment interfaced is implemented by all of cashProcessor,cardProcesoor and coinProcessor.
Attributes: For each class, define the attributes (data) it will hold...
Methods: Define the methods (functions) that operate on the attributes. Ensure they align with the object's responsibilities and adhere to the principle of encapsulation.
public class Car { ... } // ExampleSingle relationship principle:
Explain how your design can handle changes in scale and whether it would be easily to extend with new functionalities...
Try creating a class, flow, state and/or sequence diagram using the diagramming tool. Mermaid flow diagrams can be used to represent system use cases. You can ask the interviewer bot to create a starter diagram if unfamiliar with the tool. Briefly explain your diagrams if necessary...
Critically examine your design for any flaws or areas for future improvement...