Write a program that lets the user enter four quarterly sales figures for 3 divi
ID: 3627746 • Letter: W
Question
Write a program that lets the user enter four quarterly sales figures for 3 division of a company. (you may want to use a file or an intialize list instead of inputting from the keyboard)The figures should be stored in a two-dimensional array.
Once the figures are entered, the program should display the following data:
1) A list of the sales fgures by divison and quarter
2)Total sales for all quarters
3)The Average salesfor all quarters
Should look like
Qtr1 Qtr2 Qtr3 Qtr4
Division 1
Division 2
Division 3
Total Sales
Average Sales
Explanation / Answer
#include #include using namespace std; // Use global data for array sizes and array names const int MAX_DIVISIONS = 6, MAX_PERIODS = 4; string divisionName[] = {“Pacific”, “Mountain”, “North Central”, “South Central”, “Northeast”, “Southeast” }; string periodName[] = {“First Quarter”, “Second Quarter”, “Third Quarter”, “Fourth Quarter” }; // Function prototypes shown below void getInput( double sales[MAX_PERIODS][ MAX_DIVISIONS] ); void printSalesTable( double sales[MAX_PERIODS][ MAX_DIVISIONS],double periodTotal[], ofstream& outFile ); void printPercentIncrease( double sales[MAX_PERIODS][ MAX_DIVISIONS],double periodTotal[], ofstream& outFile ); void printTopDivision( double sales[MAX_PERIODS][ MAX_DIVISIONS],ofstream& outFile ); int main() { double sales[MAX_PERIODS][ MAX_DIVISIONS]; double periodTotal[MAX_PERIODS]; getInput( sales ); ofstream outFile; printSalesTable( sales, periodTotal, outFile ); printPercentIncrease( sales, periodTotal, outFile ); printTopDivision( sales, outFile ); return EXIT_SUCCESS; } void getInput( double sales[MAX_PERIODS][ MAX_DIVISIONS] ) { // Get input data in this routine. Prompt user for keyboard // input, checking for negative sales figures coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.