I am supposed to write a food menu program for this one summer class an i have been trying for the past 2 hours to figure it out.

Directions:
Write a program which allows the user to choose a beverage, sandwich and side order from a menu. After the choices are made, the program should do the following:

•list the items chosen with the cost of each item
•the sub-total of just the items
•the total cost including tax (use 6.5% for the tax).
The following are the items and prices you must include:

Beverages:

1: Soda: $0.99
2: Milk: $0.79
3: Juice: $1.29


Sandwiches:

1: Hamburger: $0.99
2: Cheeseburger: $1.09
3: Chicken Sandwich: $2.59


Side Orders:

1: French Fries: $0.89
2: Onion Rings: $1.09
3: Corn Chips: $0.59

The output should look something like this (you have some freedom to decide on your output, but it must include the items and prices, the sub-total, the tax, and the total cost including tax)

Soda: $0.99
Hamburger: $0.99
French Fries: $0.89

Total of food: $2.87
Tax: $0.19
Total for order: $3.06


Here is the code I have:

#include <iostream>
#include <string>

using namespace std;

int main()
{
int drink;
int sandwich;
int side;
int dcost;
int swcost;
int socost;

cout << "This program lists the drink, side order," << endl;
cout << "and sandwich choices along with the prices" << endl;
cout << "of each. After they are all picked it" << endl;
cout << "calculates the subtotal and then the" << endl;
cout << "total including tax." << endl;

cout << "\n" << endl;

cout << "List of Drinks" << endl;
cout << "1. Soda: $0.99" << endl;
cout << "2. Milk: $0.79" << endl;
cout << "3. Juice: $1.29" << endl;

cout << "Please type 1, 2 or 3 here: " << endl;
cin >> drink;
if (drink == 1)
dcost == "$0.99";
if (drink == 2)
dcost == "$0.79";
if (drink == 3)
dcost == "$1.29";

cout << "\n" << endl;

cout << "List of Sandwiches" << endl;
cout << "1. Hamburger: $0.99" << endl;
cout << "2. Cheeseburger: $1.09" << endl;
cout << "3. Chicken Sandwich: $2.59" << endl;

cout << "Please type hamburger, cheeseburger or chicken here: " << endl;
cin >> sandwich;
if (sandwich == 1)
swcost == "$0.99";
if (sandwich == 2)
swcost == "$0.79";
if (sandwich == 3)
swcost == "$2.59";

cout << "\n" << endl;

cout << "List of Side Orders" << endl;
cout << "1. French Fries: $0.89" << endl;
cout << "2. Onion Rings: $1.09" << endl;
cout << "3. Corn Chips: $0.59" << endl;

cout << "Please type fries, rings or chips here: " << endl;
cin >> side;
if (side == 1)
socost == "$0.99";
if (side == 2)
socost == "$1.09";
if (side == 3)
socost == "$2.59";
cout << "\n" << endl;

cout << "Receipt:" << endl;
cout << drink << ": " << dcost << endl;
cout << sandwich << ": " << swcost << endl;
cout << side << ": " << socost << endl;

return 0;
}


I really, really, really need help.

Recommended Answers

All 5 Replies

What kind of help do you need? Are there errors that you do not understand?

Total of food: $2.87
Tax: $0.19
Total for order: $3.06

Man that's a cheap meal! What country do you live in where you can get a soda, burger and fries for 3 bucks at only 6% sales tax!
Anyhow.. I think your code is fine and its almost finished.. what's the trouble?

What kind of help do you need? Are there errors that you do not understand?

I do not know how to display the price of the items or how to assign a price to each. My if statements don't work.

Man that's a cheap meal! What country do you live in where you can get a soda, burger and fries for 3 bucks at only 6% sales tax!
Anyhow.. I think your code is fine and its almost finished.. what's the trouble?

My if statements aren't working...

Your assigment operation is wrong . You should write it this way:

if(side==1)
socost=0.89;

You initialize socost as an integer so you shouldn't assign a string to it.
To display the order you can do the following:

if(side==1)
{cout<<"French Fries: 0.89"<<endl;
socost=0.89;
}

And do the same for the rest at the end to calculate the total price you just need to add socost+dcost+swcost.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.