//FoodPlusPlus.cpp #include "dishes.h" #include "FoodPlusPlus.h" ofstream FoodPlusPlus::central_records("AllSales.txt"); FoodPlusPlus::FoodPlusPlus() { int i; for (i=0; i<20; i++) theBill[i]=0; } FoodPlusPlus::~FoodPlusPlus() { central_records.close(); } void FoodPlusPlus::start_business_day() { numberofitems=0; totalsales=0.0; int customer_number; for (customer_number=0; customer_number<5; customer_number++) {take_an_order();} } void FoodPlusPlus::close_for_the_day() { central_records << "Total Sales for today: $" << totalsales << endl; } void FoodPlusPlus::take_an_order() { int i; numberofitems=0; char choice; for (i=0; i<20; i++) theBill[i]=0; i=0; bool ordermore=true; cout << "\nWelcome to Food Plus Plus! Do you get a discount? (y/n) "; char disct; cin >> disct; Dish::setdiscount((disct=='y')); cout << "May I take your order?" << endl; while (ordermore) //for each item ordered { cout << "Would you like pasta or a sandwich?" << endl; cout << "p: pasta" << endl; cout << "s: sandwich" << endl; cout << "n: nothing more" << endl; cin >> choice; ordermore = (choice!='n'); if (ordermore) { if (choice == 'p') theBill[i]=new Pasta; else if (choice = 's') theBill[i]=new Sandwich; theBill[i]->getchoices(); i++; } //end if(ordermore) } //end while(ordermore) numberofitems=i; cout << "Thank you for your order.\n"; float billtotal=0; for (i=0; iprintbillitem(cout); theBill[i]->printbillitem(central_records); billtotal+=theBill[i]->getPrice(); } cout << "Your total is $" << billtotal << "\n\n"; central_records << "\tTotal: $" << billtotal << endl; totalsales+=billtotal; }