1. ## **edit**code check

I'm supposed to write a program with the following information, but I'm not exactully sure how because of poor examples from my source books. im supposed to use loops

You will have 3 functions in addition to the main function
Get_list will print the list for the user and get the input from the user
Total_cost will calculate the total cost of the items
Take_money will print the bill, get the debit input from the user and print the change. Use an error trap so that a debit of more than \$20.00 over the bill or a debit less than the bill will not be accepted.

You will need to use the following constants
MILKPRICE = 1.37
EGGPRICE = 1.29

Code:
```Here is your main function. You must use this in your program - do not change it.

//=============================main=============
int main()
{ int eggs, milk, bread;// entered by user
float bill;// calculated

Take_money(bill);

return 0;
}// end main```

****edit***opps, sorry...i forgot to add what i had come up with so far. i'm sorry, i wouldn't want to do someone one elses homework either**

Code:
```#include <iostream.h>

//=============================main========================
int main()

{ int eggs, milk, bread;// entered by user
float bill;// calculated

bill= 0.0;

Take_money(bill);

return 0;
}// end main

const double MILKPRICE = 1.37, EGGPRICE = 1.29, BREADPRICE = 0.88

///==================Get_list=========
void Get_list()
{
cout<< " Please enter the number or items you would like"<<endl;

cout<< " How many quarts of milk @ \$1.37 :  "<<endl;
cin>> milk;

cout<< " How many dozens of eggs @ \$1.29 : "<<endl;
cin >> eggs;

cout<< " How many loaves of bread @ \$0.88 : " << endl;

} //end get_list

//==========Total_cost==========
{
Total_cost= MILKPRICE * milk + EGGPRICE * eggs + BREADPRICE * bread
} // end Total_cost

//==========Take_money=====
{

cout<<"Please enter the amount you want debited:"<<endl;
cin>>Take_money;

if(Take_money >50)
{
cout<<"Sorry, you have a limit of \$20.00 over your bill." << endl;
cout<< Your maimum debit can be" << bill + 20<< endl;
}

}//end Take_money```

2. We're not going to do your homework for you. At least start it and post what you get. We'll help you fix it up if it's still not working.

3. ## First stage of solution :)

Code:
```#include <iostream>

const double MILKPRICE = 1.37,EGGPRICE = 1.29,BREADPRICE = 0.88;

{
double total;

public:

void get_list();
double total_cost();
void debit_bill();
};

{
egg = milk = bread = 0;
total = 0.0;
}

{
std::cout << "Enter the no: of eggs (0 if not needed)";
std::cin >> egg;

std::cout << "Enter the no: of liters of milk (0 if not needed)";
std::cin >> milk;

std::cout << "Enter the loaves of bread (0 if not needed)";
}

{
total = MILKPRICE * milk + EGGPRICE * egg + BREADPRICE * bread;
}

{
std::cout << "Item\t\tQuantity\t\tPrice" << std::endl;
std::cout << "Egg \t\t" << egg << "\t\t\t" << EGGPRICE * egg << std::endl;
std::cout << "Milk\t\t" << milk << "\t\t\t" << MILKPRICE * milk << std::endl;
std::cout << "Total\t\t\t\t\t" << total <<std::endl;
double cash_accept;

std::cout << "Enter the amount given by the customer" << std::endl;
std::cin >> cash_accept;

if(cash_accept < total)
{
std::cout << "Pay up buddy.. no credit accepted" << std::endl;
}
else
{
std::cout << "You have been kind... i will keep the change" << std::endl;
}
}

int main()
{