Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3 A restaurant has a special discount for families of at least 5 members. To get the discount, at least 4 members of the

Question 3
A restaurant has a special discount for families of at least 5 members. To get the discount, at least 4 members of the family must order the special steak dish on the menu, and the family must order at least 2 bottles of wine. The waiter serving the family must tell the families about the special discount. If the family order qualifies for the discount, the waiter gets an extra commission which is 3% of the total bill amount. Peter wants to know how much commission he earned for the evening.
Your task is to write a program that will read the file orders. dat and calculate the number of families that ordered the special, the extra commission earned by Peter, as well as the average spent per person (including all the people that he served for the evening).
Each line in the file contains the following data: the number of members in a family, the number of family members that ordered the special, the number of bottles of wine that the family ordered, and the total bill amount. Create the file orders. dat containing the orders of all the families that Peter served, as specified below. Declare variables of type int for the first three values and a variable of type float for the total bill amount.
\table[[5,2,2,670.60],[6,4,2,890.80],[2,2,0,220.00],[10,8,1,1340.60],[10,4,3,1430.70],[4,0,0,460.30],[5,3,1,700.00],[7,5,2,1100.80],[3,1,0,340.80]]
Using the input file above, your program should create the following results in the output file result.dat:
Displaying contents of result.dat :
Number of families that ordered the special: 3 Commission earned from the special meal: R102.67 Average spent per person for the evening: R137.59
image text in transcribed

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

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions