Question
Write a C++ console application for the following lab: Sales Program Variables: An array of double to hold each months sales. Methods: Average - Calculates
Write a C++ console application for the following lab: Sales Program Variables: An array of double to hold each months sales. Methods: Average - Calculates the average sales for the year. Pass in an array of type double. Create a program called Sales. The program should contain an array that stores monthly sales figures. . Method ShowReport: Add a method called ShowReport() that will print a report. Takes an array of double as a parameter. The report should show a detail line for each month. It should also show the average sales for the year and the total sales for the year. For example:
Jan 100.00 Feb 130.00 Dec 120.00 Avg 105.00 Total 1300.00 Note: Use a loop to print the data. 2. Method ShowReportToFile: Takes an array of double AND a filename as parameters. The method should print the exact same data as the ShowReport method does but write it to a file instead the name of the file to write to should be passed in as a parameter. The ShowReportToFile method should have the following signature: void ShowReportToFile (double sales[], string name) THEN:
Modify that it shows the following menu: Sales Program ----------------- 1. Print report to console 2. Print report to file 3. Exit Enter Choice: Take the appropriate action when the user makes a choice. For example, if the user enters a 1 then the program should show the report on standard output. Once the report is printed (to the console or a file) the program should redisplay the menu and allow the user to enter another choice. The program should only end when the user types in a 3.
Step 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