Question:
Java UML diagram from a given scenario?
anonymous
2011-03-31 07:11:38 UTC
Suppose a vending machine contains products, and users insert coins into the vending machine to purchase products. How would I draw a UML diagram showing the dependencies between the classes VendingMachine, Coin, and Product?
Three answers:
anonymous
2011-03-31 07:35:12 UTC
There could be more than one model depending on the understanding of the relations between the classes.

A simple one would have to model the Customer as a class too. In this case, you will have the following relationships:

VendingMachine - Coin (because the vending machine receives coins)

VendingMachine - Customer (because the customer interacts with the vending machine)

VendingMachine - Product (because the vending machine has the products)



Customer - Coin (because the customer insert coins into the vending machine)

Customer - Product (because the customer wants to acquire a product)



The diagram can be found on page 14 in the source [1]



A more complex model can be found in the source [2]
deonejuan
2011-03-31 07:22:24 UTC
Actually, the vending machine could give a rat's petunia where the coins came from. In most completed diagrams the customer interacts with a vending machine. The vending machine has all the processing.



Vending machine is many UML books. Google to find more.
?
2016-12-16 09:22:33 UTC
Vending Machine Class Diagram


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...