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: | 339 Weeks Ago, 5 Days 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