Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(C++) Plan and code a program utilizing one file for input and one file for output to solve the following problem: A. For adults, the

(C++) Plan and code a program utilizing one file for input and one file for output to solve the following problem: A. For adults, the deluxe meals will cost $25.80 per person and the standard meals will cost $21.75 per person, dessert included. Children's meals will cost 60 percent of adult meals. Everyone within a given party must be served the same meal type. B. All customers will be charged the same rate for tip and tax, currently 18 percent (applied only to the cost of the food). C. A surcharge, currently 7 percent, is added to the total bill if the catering is to be done on the weekend (Friday, Saturday, or Sunday). D. To induce customers to pay promptly, a discount is offered if payment is made within ten days. E. This discount depends on the amount of the total bill. If the bill is less than $100.00, the discount is 1.5 percent; if the bill is at least $100.00 but less than $400.00, the discount is 2.5 percent; if the bill is $400.00 or more, the discount is 3.5 percent. Input Number of adults, number of children, meal type (D, S) character indicating whether or not date is a weekend (Y/N), amount of any deposit. Create the data file below in text editor or Notepad. Data File 10 0 S Y 100.00 27 3 D Y 57.50 125 17 D N 0.00 4 0 S N 25.00 0 25 S Y 23.75 250 43 D N 500.00 0 0 D N 0.0 10 0 R Y 10.00 17 3 D R 15.00 5 0 D Y 275.00 -3 10 D Y 20.00 14 -1 S N 30.00 20 3 D Y -10.00 Output Output an itemized bill listing the number of adults, children, cost for adult meals, cost for children's meals, total food cost, surcharge (if appropriate), tax and tip, total cost of the party, deposit (if any), total balance due, amount of discount if bill is paid within ten days. Output error data to a separate error file.

This is what i have but its not working HELP!!!

#include #include #include #include using namespace std; int main() { ifstream infile; ofstream outfile; inFile.open("C:\\temp\\infile6.txt"); if (!inFile) //there was an error on open, file not found { cout << "Cannot open file, terminating program" << endl; exit(1); } outFile.open("C:\\temp\\outfile6.txt");

int i, j; int const row = 6; int const col = 4; int const numbers_per_line = 5; double num, highest, lowest, sum, average; double partial_sum = 0; while (!inFile.eof()) { if (line.erase(0, s.find_first_not_of(" \t", 0)).empty()) continue; std::istringstream(line) is; int lowest = 0, highest = 0; int sum = 0, average = 0; size_t count = 0; int number = 0; while (is >> number) { if (count == 0) { lowest = highest = number; } else if (number < lowest) { lowest = number; } else if (highest < number) { highest = number; } count++; sum += number; } if (count != 0) average = sum / count; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

9th Edition

ISBN: B01JXPZ7AK, 9780805360479

More Books

Students also viewed these Databases questions

Question

2. What are your challenges in the creative process?

Answered: 1 week ago