### Burger King Program Help!

Hi, I'm new to C++ programming and I have to complete this project. It's a Burger King Self Service Program.

Design a Burger King self order program that accepts customerâ€™s order and finishes the transaction. Suppose there are three types of burgers:
1. Burger (\$2.00)
2. Bacon Burger (\$2.50)
3. Cheese Burger (\$2.50)
There are three types of drinks:
1. Diet Coke (\$1.00)
2. Mountain Dew (\$1.00)
3. Beer (\$2.00)
Your program should run as follows,
(1). First, ask the customer which burger he/she wants.
(After customer gives the correct input.)
(2). Second, ask the customer which drink he/she wants.
(After customer gives the correct input.)
(3). Compute the total price for the customer (tax rate: 8%).
(4). Then serve the next customer until there is no customer left.

I've started it, but I am stuck on how to implement the 8% tax and computing the total cost. Help will be appreciated! Thanks!
_________________________________________________________

#include <iostream>
#include <string>
#include <cmath>

using namespace std;

double total = 0;

int main() {

string choice1;
string choice2;
string choice3;
string choice4;
string choice5;
string choice6;
double price;
double total_cost;

cout << "Hello and welcome to Burger King!";
cout << "\n";
cout << "\n";
cout << "BURGERS" << endl;
cout << "1. Burger - \$2.00" << endl;
cout << "2. Bacon Burger - \$2.50" << endl;
cout << "3. Cheese Burger - \$2.50" << endl;
cout << "Please input the choice number of the burger you desire (number) .";
cin >> choice1;

if(choice1 == "1" || choice1 == "1.")
{
price = 2.00;
}
else if(choice1 == "2" || choice1 == "2.")
{
price = 2.50;
}
else if(choice1 == "3" || choice1 == "3.")
{
price = 2.50;
}

cout << "DRINKS" << endl;
cout << "4. Diet Coke - \$1.00" << endl;
cout << "5. Mountain Dew - \$1.00" << endl;
cout << "6. Beer - \$2.00" << endl;

cout << "Okay, would you like anything to drink with that? (y/n): ";

char response;
cin >> response;
if (response == 'y')
{
cout << "Please input the choice number of the drink you desire (number) .";
}
else if (response = 'n')
cout << "Okay, your total price is ." << endl;

cin >> choice4;

if(choice4 == "4" || choice4 == "4.")
{
total == 1.00;
}
else if (choice5 == "5" || choice5 == "5.")
{
total == 1.00;
}
else (choice6 == "6" || choice6 == "6.");
{
total == 2.00;
}

if (response = 'n')
cout << "Okay, your total price is ." << endl;
system ("pause");
return 0;
}

You can accumulate the price together as the customer orders using +=.

After the customer orders choice 1, price += 2.00
Then customer orders drink4, price(2.00) += 1.00

Final price 3.00, multiply 0.92 for tax.

Or keep it the way it is, in the end have your unused total_cost = price + total; total_cost *= 0.92. And I think the operator following total should have been an assignment (=) instead of equality (==).
Last edited on
1 cheese burger and diet coke please :D !!!, man seriously have u coded in C before starting with C++, no method based approach or Object based approach, cmmon u cannot have all the code in main function and do everything in main function.
Last edited on
Topic archived. No new replies allowed.