Question Details:
I am having difficulty implimenting these umls. I dont even know how to start. Please help.
uml1
Item
-string name
-int cost
-int quantity
+item (string,int,int)
+string getName()
+string getCost() //formatted $d.cc
+int get getQuantity()
+void setName(string)
+void setCost()
+void setQuantity
uml2
Machine
-Item[9] items
-int money
+istream& operator >> (istream& in)
+void displayState()
+void depositMoney()
+void purchaseItem()
this is a general description of the problem i am try to do: Write a simulation for a high-tech vending machine. After an initial state is established for the machine(i.e., the items for sale, their costs, and the initial inventory counts), the user can have an interactive dialog with the simulation. In this dialog the user can:
1. View the current state of the machine
2. Deposit money into the machine
3. Purchase an item in the machine, which subsequently will return any change the user is owed
For simplicity, assume that the vending machine has exactly nine types of item for sale.
Use the following data as input to initialize the state of the machine.
You will define two classes, an item class and a machine class, to implement this simulation. The UML for theses classes is shown below.
Problem Statement
Write a vending machine simulation in which the user is able to go through an interactively choose to: view the machines status, deposit money, and purchase an item.
Input Output Description
1. displayState() will display each of the items names and available quantities in the machine in matrix form as well as how much money has been inserted into the vending machine so far.
2. depositMoney() will take an amount of money to deposit as input by the user.
3. purchaseItem() will take as input the number of the item to be purchased. It will produce as output an error message if the user has not input enough money for a given item, or will display the amount of change the user is to get back if there is enough money.
4. the >> operator will read data in the form of text. Each line of data contains the name, price, and quantity of one item that is to be added to the machines item set.
Thank you very much for any help.