Question: This program loads a monthly report from a report file and displays the consolidated sales for a given range of months. First, the program will
This program loads a monthly report from a report file and displays the consolidated sales for a given range of months.
First, the program will ask the user to provide the filename of the monthly report file. Then the user will provide the number of months that will be consolidated and displayed. For example, if the user selects 1 then the total sales for each month will be shown. If the user selects 2 then every two months' total sales will be added and shown. If the user selects 3 then the every three months' total sales is shown, and so on.
The program should only accept values equal to one or greater. Otherwise the program should display an error.
If the number of months provided by the user does not evenly divide into the total number of months in the report, then it will just show the ranges that contain enough months. For example, if the user selects 2 and there are only 5 monthly reports, then it will display the total sales for months 1 and 2, and 3 and 4, only.
Below is an example of a possible monthly report file.
999.99 705.67 803.23 400.54
Please note that I am only allowed to use loops and conditions. This is c++. Months are not needed in the file.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
