Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c++ code Total and Average Sales: Write a program that reads the amount of sales (as integer values) at the end of each month for
c++ code
Total and Average Sales: Write a program that reads the amount of sales (as integer values) at the end of each month for ABC Supermarket of 5 departments (grocery, bakery, meat, vegetables, and electronics) The program reads all data from the input file sales_2017.txt. The first line has an integer value N that represents the number of months to be processed. The following N input lines contain the name of the month followed by the sales of each department in that month (5 integer values). Your program shall produce a nice report in a file (call it 'sales_report_2017.txt') showing the total sum of all sales and the average sales per month. Format your output to produce an exact result as in the sample below 5. Input file (sales 2017.txt) Output file (sales_report 2017.txt) Total sales per month: SEP 158788 712310 1876510 796470 1250968 OCT 198456 698274 1783884 866432 1653426 NoV 139883 512011 1912398 996447 1527372 DEC 98701 200037 926318 436490 900998 AN 100700 399918 2000517 526488 1418617 FEB 113579 870067 1555516 486460 1300129 MAR 120104 498515 1009512 956479 1050087 Month Sales 1 SEP 2 OCT 3 NOV 4 DEC 5 JAN 6 FEB 7 MAR 4795046 5200472 5088111 2562544 4446240 4325751 3634697 Total sales in 7 months is: 20951264.00 Average sales per month is: 2993037.7Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started