Question: Write a program that reads a file consisting of restaurant ratings and the date the rating was submitted. It should then determine the number of
Write a program that reads a file consisting of restaurant ratings and the date the rating was submitted.
It should then determine the number of ratings in each of the following ranges : 1 - 2 (Unacceptable), 3 - 4 (Poor), 5 - 6 (Average), 7 -8 (above average), 9 -10 (very good).
The earliest and latest submission date of each rating range must also be shown. A sample output is :
TUSCAN GARDEN CUSTOMER RATING REPORT
Rating Total Earliest Date Latest Date
1 - 2 (Unacceptable) 2 12/10/16 12/21/16
3 - 4 (Poor) 5 12/07/16 01/18/17
5 - 6 (Average) 12 11/30/16 02/21/17
7 - 8 (above average) 29 12/11/16 03/30/17
9 -10 (very good). 17 01/20/17 03/31/17
Notes :
The program must use at least 2 functions :
A function that takes as parameters an array and the number of elements (dates) loaded into it and returns the earliest date. (see #3 below)
A function that takes as parameters an array and the number of elements (dates) loaded into it and returns the latest date. (see #3 below)
Potential pseudocode solution :
declare 5 string arrays (one for each rating)
read first input record
if (inFile.eof())
output message The input file is empty
else
output heading lines
while (!inFile.eof())
use rating to load date information into the appropriate array
(be sure to keep track of how many elements are loaded into each array)
for each rating, do the following :
call earliest date function
call latest date function
output detail line
declare functions
3. The logic for the 2 function is similar to the indexLargestElement function logic in Example 8-6 in the textbook on pages 534 535. (Edition 6, pages 520 -521) MAlik c++
Sample data file:
05 11/30/17 03 12/07/17 05 12/07/17 05 12/08/17 01 12/10/17 07 12/11/17 07 12/14/17 06 12/15/17 02 12/21/17 05 12/21/17 06 12/22/17 07 12/22/17 08 12/23/17 07 12/23/17 07 12/23/17 07 12/23/17 08 12/24/17 08 12/24/17 07 12/24/17 03 12/26/17 05 12/26/17 07 12/28/17 04 12/29/17 07 01/01/18 06 01/03/18 07 01/03/18 08 01/05/18 05 01/10/18 04 01/18/18 08 01/18/18 07 01/18/18 07 01/18/18 08 01/18/18 08 01/18/18 08 01/18/18 07 01/18/18 04 01/18/18 05 01/18/18 06 01/19/18 10 01/20/18 08 01/21/18 10 01/21/18 09 01/21/18 09 01/21/18 10 01/21/18 07 01/21/18 07 01/21/18 06 02/21/18 09 02/22/18 09 02/22/18 09 02/22/18 07 02/25/18 09 02/26/18 08 02/28/18 07 03/03/18 10 03/03/18 10 03/04/18 09 03/05/18 07 03/10/18 09 03/15/18 09 03/20/18 10 03/22/18 07 03/30/18 09 03/30/18 09 03/31/18
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
