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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
