uml1 Item -string name -int cost -int quantity +item (string,int,int) +string ge
ID: 3611546 • Letter: U
Question
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 aninitial state is established for the machine(i.e., the items forsale, their costs, and the initial inventory counts), the user canhave an interactive dialog with the simulation. In this dialog theuser 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 returnany change the user is owed
For simplicity, assume that the vending machine has exactly ninetypes of item for sale.
Use the following data as input to initialize the state of themachine.
Tortilla_Chips 60 3
Pretzels 60 10
Popcorn 60 5
Cheese_Crackers 40 2
Creme_Cookies 65 1
Mint_Gum 25 5
Chocolate_Bar 55 3
Licorice 85 9
Fruit_Chews 55 7
Create a text file with the above data and overload the >>operator within the machine class to read this data and create thecorresponding objects.
Items should be organized and displayed as a 3x3 matrix.
Item0 Item1 Item2
Item3 Item4 Item5
Item6 Item7 Item8
You will define two classes, an item class and a machine class, toimplement this simulation. The UML for theses classes is shownbelow. Problem Statement
Write a vending machine simulation in which the user is able to gothrough 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 andavailable quantities in the machine in matrix form as well as howmuch money has been inserted into the vending machine so far.
2. depositMoney() will take an amount of money to deposit as inputby the user.
3. purchaseItem() will take as input the number of the item to bepurchased. It will produce as output an error message if the userhas not input enough money for a given item, or will display theamount of change the user is to get back if there is enoughmoney.
4. the >> operator will read data in the form of text. Eachline of data contains the name, price, and quantity of one itemthat is to be added to the machines item set.
Thank you very much for any help.