Question: In this project you will create a program that will calculate the quarterly sales for a company. You will be using two arrays to store
In this project you will create a program that will calculate the quarterly sales for a company. You will be using two arrays to store the quarterly sales figures and the quarterly names Q1, Q2, Q3 and Q4. Since you will be dealing with money you will need to use a double datatype. The program will prompt the user for the quarterly sales figures for each quarter, Q1 through Q4. Here are some of the main variables you will need to create for the program:
Quarter[4] Is a string array that holds quarterly names Q1, Q2, Q3, and Q4.
quarterlySales[4] Is an array that holds the quarterly sales for the year
Once you have gotten the quarterly sales numbers you will pass the quarterlySales array to the following functions:
Function that will sum the quarterly sales and return the yearly sales
Function that will average the quarterly sales and return the average quarterly sales
Function that will return the index (subscript) of the quarter with the highest sales amount
Function that will return the index (subscript) of the quarter with the lowest sales amount
Function that will sort the array in ascending (lowest to highest) order 1, 2, 3, etc.
You should display:
Total quarterly sales for the year
Average quarterly sales for the year
Quarter with the highest sales and the sales amount
Quarter with the lowest sales and the sales amount
Quarter sales sorted from lowest to highest. Display the
quarter and the amount Formatting the output: You will need to format all sales with a $ and 2 decimal points precision.
Program Output:
quarterly sales.
This program calculates total
Please enter the gross sales received on Q1: $123652.36 Please enter the gross sales received on Q2: $356242.58
Please enter the gross sales received on Q3: $324562.85
Please enter the gross sales received on Q4: $120253.25
The total quarterly sales for the year were: $924711.04 The average quarterly sales for the year were: $231177.76
The quarter with the highest sales amount was Q2 with a sales total of $356242.58 The quarter with the lowest sales amount was Q4 with a sales total of $120253.25
Quarterly sales sorted from lowest to highest: Q4 had gross sales of $120253.25 Q1 had gross sales of $123652.36 Q3 had gross sales of $324562.85
Q2 had gross sales of $356242.58 Press any key to continue . . .
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
