I am in the last part of the program and everything is working but one final thing. I need to get all the Subtotals, taxes, and total cost to add up....I tried using sums, counts, and change the variable names and still having trouble....this program has been a real pain
//Name: Bryan Kruep
//Class: CS 140-001
//Assignment: Lab 2
//Date: 01/22/08
#include <iostream>
#include <string>
using namespace std;
const double TACO_COST = 0.49;
const double HOTDOG_COST = 0.75;
const double DRINKS_COST = 0.99;
const double SOURCREAM_COST = 0.15;
const double TAX_RATE = 0.0725;
int sum = 0;
int main ()
{
int hotdogquantity = 0, tacoquantity = 0, sourcreamquantity = 0, drinkquantity = 0;
double hotdogs_total_cost, tacos_total_cost, tacos_with_sourcream_total_cost, drinks_total_cost, subtotal, taxes, total_cost;
char ans;
int count = 1;
cout << endl << "Programmed By: Bryan Kruep \n" <<endl;
do
{
if (hotdogquantity >= 0)
{
cout << "Number of Hotdogs: ";
cin >> hotdogquantity;
}
while (hotdogquantity < 0)
{
cout << "Number of hotdogs cannot be a negative number!! Try again: ";
cin >> hotdogquantity;
}
if (tacoquantity >= 0)
{
cout << "Number of Tacos: ";
cin >> tacoquantity;
}
while (tacoquantity < 0)
{
cout << "Number of tacos cannot be a negative number!! Try again: ";
cin >> tacoquantity;
}
if (sourcreamquantity < tacoquantity)
{
cout << "How many of those tacos with sour cream: ";
cin >> sourcreamquantity;
}
while (sourcreamquantity > tacoquantity || sourcreamquantity < 0)
{
cout << "Can't have more tacos with sourcream than the number of tacos ordered. Number of sour creams cannot be a negative. Try again!: ";
cin >> sourcreamquantity;
}
if (drinkquantity >= 0)
{
cout << "Number of drinks: ";
cin >> drinkquantity;
}
while (drinkquantity < 0)
{
cout << "Number of drinks cannot be a negative number!! Try again: ";
cin >> drinkquantity;
}
cout << endl << endl << endl << "BILL";
cout << endl << "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _";
cout << endl << "\t" << hotdogquantity << " Hotdogs";
cout << endl << "\t" << tacoquantity << " Tacos" << " - " << sourcreamquantity << " with sour cream";
cout << endl << "\t" << drinkquantity << " Drinks";
//Calculate totals
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
hotdogs_total_cost = hotdogquantity * HOTDOG_COST;
tacos_total_cost = tacoquantity * TACO_COST;
tacos_with_sourcream_total_cost = sourcreamquantity * SOURCREAM_COST;
drinks_total_cost = drinkquantity * DRINKS_COST;
subtotal = hotdogs_total_cost + tacos_total_cost + tacos_with_sourcream_total_cost + drinks_total_cost;
taxes = subtotal * TAX_RATE;
total_cost = subtotal + taxes;
//Display output
cout << endl << endl << "Subtotal: " << subtotal;
cout << endl << "Taxes: " << taxes;
cout << endl << "Total: " << total_cost;
cout << endl;
sum = 0 ;
cout << endl << "Another order? (Y/N)";
cin >> ans;
cout << endl << endl;
hotdogquantity = 0;
tacoquantity = 0;
sourcreamquantity = 0;
drinkquantity = 0;
}while ( (ans != 'n') && (ans != 'N') );
new_total = subtotal + new_total;
new_taxes = taxes + new_taxes;
cout << "Total Day Receipts";
cout << endl << "_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _";
cout << endl << endl << "Subtotal: " << new_total;
cout << endl << "Taxes: " << taxes;
cout << endl << "Total: " << total_cost;
cout << endl << endl;
return 0;
}