stuck on c++ program

Hi everyone im having trouble with writing this program. Any help will be appreciated!

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.

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 the corresponding 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, to implement this simulation. The UML for theses classes is shown below.
class Item
{
public:
Item();
Item(string,int,int);
string getName();
string getCost();
int getQuantity();

void setName(string);
void setCost(int);
void setQuantity(int);

private:
string name;
int cost;
int quantity;
};

class Machine
{
public:
Machine();
void displayState();
void depositMoney();
void purchaseItem();

friend istream& operator >>(istream& in, Machine& m);

private:
int money;
Item items;
int purchase;
};

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.

Thanks for all the help!
Topic archived. No new replies allowed.