Question
Can someone help me add command to save out program in a file. program as below. i want this program to save the output and
Can someone help me add command to save out program in a file. program as below. i want this program to save the output and generate receipt.
#include #include #include #include
using namespace std;
int main() { string NameOfEvent, CustomerName; // Name of Event + Customer Name double NumberOfGuests; // Number of Guests in attendance int NumberOfMinutes; // Number of Minutes in the event
// Information input (Events name and amounts)
cout << "Enter the name of the event " << endl; getline(cin, NameOfEvent); cout << "Enter the customer's first and last name " << endl; getline(cin, CustomerName); cout << "Enter the number of guests " << endl; cin >> NumberOfGuests; cout << " Enter the number of minutes in the event " << endl; cin >> NumberOfMinutes;
cout << "Fall Dinner " << endl; cout << "Event estimate for " << CustomerName << endl;
int NumberOfServers, Cost1; double CostForOneServer,Test, TotalFoodCost, AverageCost, Cost2, DepositAmount,TotalCost;
const double CostPerHour = 18.50; const double CostPerMinute = .40; const double CostOfDinner = 20.70;
// Get Number Of Servers Test = NumberOfGuests / 20; NumberOfServers = ceil(Test);
// Get Cost Of One Server Cost1 = (NumberOfMinutes / 60) * CostPerHour; Cost2 = (NumberOfMinutes % 60) * CostPerMinute; CostForOneServer = Cost1 + Cost2;
// Get Cost For Food TotalFoodCost = NumberOfGuests * CostOfDinner;
// Get Average Cost Per Person AverageCost = TotalFoodCost / NumberOfGuests;
// Get Total Cost TotalCost = TotalFoodCost + (CostForOneServer * NumberOfServers);
// Get Deposit Amount (50%) DepositAmount = TotalCost * .50;
// Print values above cout << "Number Of Server: " << NumberOfServers << fixed << setprecision(2) << endl; cout << "The Cost for Servers: " << setw(5) << CostForOneServer << endl; cout << "The Cost for Food is: " << setw(5) << TotalFoodCost << endl; cout << "Avergae Cost Per Person: " << setw(5) << AverageCost << endl; cout << " Total cost is: " << setw(5) << TotalCost << endl;
cout << "Please deposite a 50% deposit to reserve the event" << endl; cout << "The deposit needed is: " << setw(5) << DepositAmount << endl;
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started