Question
C++ Write a program that lets that a store keep track the sales of six different crayon colors: purple, blue, green, yellow, orange and red.
C++
Write a program that lets that a store keep track the sales of six different crayon colors: purple, blue, green, yellow, orange and red. The program shows the names of the top selling color that sell more than the average.
Start by using two parallel 6-element arrays*: an array of strings that holds the color, and an array of integers that holds the number of pieces sold during the past month for each color. Use a loop to prompt the user to enter the number of each color sold. Once the sales numbers have been entered, the program should pass the array holding the sales count to a function that computes and returns the average number of sales. Afterwards, pass both arrays and the average sales value to another function. This function outputs the top selling color by iterating over the sales array and outputting the color for each sales count that is equal to or above the average value.
The program must be implemented by using meaningful names for all variables and functions and create prototypes for both functions ABOVE the main. The implementation of both functions must be BELOW the main. Here's an example of how to pass an array to a function:
void print(int array[], const int SIZE); int main() { const int SIZE = 5; int numbers[SIZE] = {1, 2, 3, 4, 5}; print(numbers, SIZE); return 0; } void print(int array[], const int SIZE) { // print array here (details not shown for clarity) }
Add comments to the top of the code stating your name and assignment #.
If your code has any syntax errors and does not compile, it will be given at most 50% of the total score.
Always use proper formatting and follow good programming practices.
*Parallel array means multiple arrays with the same size.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started