The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Lab Program - Sales
As you complete each part of the Lab, comment outÂ
previous requirements as you progress (i.e. don't delete )
Â
Sales Program
Â
Variables: An array of double to hold each month's sales.
Â
Methods: Average - Calculates the average sales for the year.Â
Pass in an array of type double.
program called Sales. The program should contain an array that stores monthly sales figures.
Â
Questions
1. How big should the array be?
2. What is the range of indices?
3. Might there be any problems relating month numbers to array indices?
Â
Â
Â
1. 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)
Â
Â
Â
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.
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly