Question
Instead of having one long main function that contains all the statements necessary to solve the problem given in previous projects, you must write several
Instead of having one long main function that contains all the statements necessary to solve the problem given in previous projects, you must write several small functions that each solve a specific part of the problem. These small functions should then be executed in the correct order to implement a complete solution.
The named constants you used in previous projects should now be made global so you won't have to pass those values to any function.
In addition to the main function, your code must include the specified functions. These functions must be written exactly as specified to avoid a major error penalty.
Make sure your program uses the values returned from your functions. Any functions that need input to perform a task will have to accept arguments.Global variables are prohibited.
Steps:
- Use theDivide and Conquerapproach described inSection 6.1of your textbook to modularize your program.
- Make all yournamed constantsglobal.
- Write the following functions:
Function 1 - mainMenu
A void function that just displays the first menu when called. SeeSample Run #1for format.
Function 2 - streamingSerivceMenu
A void function that just displays the streaming services when called.
Function 3 - distributionLabelMenu
A void function that displays the distribution label types when called.
Function 4- generateStreams
A function that accepts the distribution label type and returns the number of streams generated based on the guidelines in Project 2.
Function 5- calculateEarnings
A function that accepts the streaming service type and the number of streams and returns the amount of money earned from the song.
Function 6- calculateLabelEarnings
A function that accepts the distribution label type and the amount earned from the total songs streamed and then returns the amount the distribution label earned.
NOTE:All functions should be coded as instructed above. Modifying the functions (meaning adding or removing parameters, changing the return type of the function, etc...) will count as a major error (i.e., one major error deduction for each function that is modified.)
Program language is DevC++
Sample run image provided below.
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