Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

  1. Use theDivide and Conquerapproach described inSection 6.1of your textbook to modularize your program.
  2. Make all yournamed constantsglobal.
  3. 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.

image text in transcribedimage text in transcribed
Choose from of the following menu options: 1: Upload a single song to a streaming service 2: Upload a multiple songs to a streaming service 3: Exit the program Enter your choice (1. 2. or 3>: |99 ERROR - NOT A VALID MENU CHOICE. PLEASE TRY AGAIN. Choose from of the following menu options: 1: Upload a single song to a streaming service 2 : Upload a multiple songs to a streaming service 3: Exit the program Enter your choice (1. 2. or 3>: 1] Which Streaming Service will you use to upload your song? 1: TIDAL 2 : Amazon 3: Apple Music 4: Spotify 5: YouTube Enter your choice : |99 ERROR - NOT A VALID STREAMING SERVICE. Please choose from the services listed. Which Streaming Service will you use to upload your song? : TIDAL Amazon 4: Apple Music 5: Spotify YouTube Enter your choice : 3] What is the artist's name? Reason What is the name of the song? The Soul How many streams does The Soul have on Apple Music? 88 ERROR - NUMBER OF STREAMS CANNOT BE NEGATIVE. How many streams does The Soul have on Apple Music? 275415 Song Name : Artist Name : The Soul Streaming Service : Reason Streams : Apple Music 275415 Earnings : $2024.30 Choose from of the following menu options: 1: Upload a single song to a streaming service 2: Upload a multiple songs to a streaming service : Exit the program Enter your choice (1, 2. or 3>: 2] Which Streaming Service will you use to upload your song(s)? 1: TIDAL 2: Amazon 4: Apple Music Spotify 5: YouTube Enter your choice : 10 ERROR - NOT A VALID STREAMING SERVICE. Please choose from the services listed.Which Streaming Service will you use to upload your song(s)? 1: TIDAL 2: Amazon 3: Apple Music 4: Spotify 5: YouTube Enter your choice : 1 How many songs will be uploaded on TIDAL? -10 ERROR - NUMBER OF SONGS CANNOT BE NEGATIVE. How many songs will be uploaded on TIDAL? 8 Which type of distribution will you use to distribute your song(s)? 1: MAJOR LABEL INDEPENDENT LABEL Enter your choice (1 or 2): 3 ERROR - INVALID DISTRIBUTION CHOSEN. Please choose from one of the options liste d. Which type of distribution will you use to distribute your song(s)? : MAJOR LABEL INDEPENDENT LABEL Enter your choice (1 or 2> : 1 Song #1: Song #2 : 128524 streams Song #3 : 108105 streams Song #4: 113047 streams Song #5: 117512 streams Song #6 : 118357 streams Song #7: 102527 streams Song #8: 118018 streams 104681 streams Streaming Service: Streams : TIDAL 910771 Earnings : $1308.51 Artist Earnings : $523 . 41 Label Earnings : $785 .11 Choose from of the following menu options: : Upload a single song to a streaming service 2: Upload a multiple songs to a streaming service 3: Exit the program Enter your choice (1. 2. or 3): |3 Thank you for using the program

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

Why have the number of major economic strikes in the U.S. declined?

Answered: 1 week ago

Question

log bas 2 ( x 4 ) + log base 2 ( x + 7 ) = 2 ,

Answered: 1 week ago