Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Could use help with this c++ problem focusing on Arrays and Search Algorithms. The daily sales of a grocery store, reported over a year, are

Could use help with this c++ problem focusing on Arrays and Search Algorithms.

The daily sales of a grocery store, reported over a year, are saved in the file sales.dat. The first value represents the daily sales for January 1, 2018 and the last value represents the sales for December 31, 2018. Write a program that reads from the file into an array of 12 elements that stores the average for each month (i.e. the first element of the array stores January average, the second element stores February average and so on). Hint: use the DAYS array. Perform statistical operations on the array using the following functions (the averages array and the size are passed as arguments to each function): a function that displays the average for each month (along with the name of the month) a function that returns the average of monthly averages (main will display it) a function that displays the month with the highest average (display the name of the month and its average) a function that displays the month with the lowest average (display the name of the month and its average) Design a good user interface. Format the values to two decimal places. Make sure to use the const keyword with the array parameter in functions where appropriate. Hint: for the highest and lowest functions, you need to keep track of the subscript that has the highest or lowest average. Use these two global arrays: const string MONTHS[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"}; const int DAYS[12] = {31,28,31,30,31, 30, 31, 31, 30, 31, 30, 31};

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

Students also viewed these Databases questions

Question

8. Describe how cultural spaces are formed.

Answered: 1 week ago