Question

You have been hired by an aspiring music artist to write a program that will help...

You have been hired by an aspiring music artist to write a program that will help the artist determine how much they will earn by releasing their song on one of the popular music streaming platforms: TIDAL, Amazon, Apple Music, Spotify, or YouTube.


Artists are paid based on the number of streams his or her song receives after it is uploaded.


Your program must use a menu to ask the user for the streaming service they are going to use to upload his or her song.


After choosing the service, the program must ask the user for the name of the artist, the name of the song, and the number of streams.


Calculate the total earnings on the song based on the payment rates for the streaming service chosen. Use the table below to determine the streaming rates for each streaming service and store each as a named constant in your program. See the Sample Output. Use named constants in your calculations and wherever else they are appropriate.


Streaming Service Pay Per Stream   
TIDAL $0.01250
Amazon $0.00402
Apple Music $0.00735
Spotify $0.00437
YouTube $0.00069

Steps:


Use a menu to offer the user a choice between the different streaming services to upload their music. The menu should be the first thing displayed when your program begins executing. The menu format MUST match the Sample Runs. Validate the menu choice so that the program terminates immediately if an invalid menu choice is entered.


After displaying the streaming service menu and getting the user’s choice, get the input of the Artist’s Name. See Sample Runs.

After getting the input of the streaming serving and the Artist’s name, get the input of the name of the song that will be uploaded. See Sample Runs.
After getting the input of the name of the song, get the input of the number of streams of the song on the chosen platform. Validate the input of the number of streams so that the program terminates if the number of streams entered is less than zero. See Sample Runs.
Calculate the amount of money generated from the number of streams of the song, then display the Artist’s Name, the name of their song, the streaming service, and the amount earned from the song. See the Sample Runs.

Your program's prompts and output MUST match the formats as the Sample Runs.

Save your .cpp file using the required naming format.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

PROGRAM:

StreamingService.cpp :

#include <iostream>
#include <stdlib.h>
using namespace std;

int main() {
// initializing constant variables to store rate
const double tidal = 0.01250, youtube = 0.00069, spotify = 0.00437, amazon = 0.00402, apple_music = 0.00735;
//variables
string artist_name, song_name;
int streams, choice;
double earn = 0.0;

// MENU
cout << "-----:Streaming Service Earning Finder:-----\n";
cout << "Choose the Streaming Service Platform:\n";
cout << "Enter 1 for TIDAL.\n";
cout << "Enter 2 for Amazon.\n";
cout << "Enter 3 for Apple Music.\n";
cout << "Enter 4 for Spotify.\n";
cout << "Enter 5 for YouTube.\n";
cout << "Enter your choice: ";

// User choice is stored
cin >> choice;

// Validating user's choice
if(choice < 1 || choice > 5){
cout << "\nWrong Choice! Exiting the program!";
// exiting the program if validation fails
exit(1);
}

// storing artist's name
cout << "\nEnter the name of the artist: ";
cin >> artist_name;

// storing song's name
cout << "\nEnter the name of the song: ";
cin >> song_name;

// storing the number of streams
cout << "\nEnter the number of streams: ";
cin >> streams;

// validating number of streams
if(streams < 0){
cout << "\nNumber of streams can't be negative!";
exit(1);
}

// calculating the earnings using switch case
switch(choice){
case 1: earn = tidal * streams;
break;
case 2: earn = amazon * streams;
break;
case 3: earn = apple_music * streams;
break;
case 4: earn = spotify * streams;
break;
case 5: earn = youtube * streams;
break;
}

// printing details of artist
cout << "\nArtist: " << artist_name;
cout << "\nSong: " << song_name;

// printing the platform chosen
switch(choice){
case 1: cout << "\nStreaming Service Chosen: TIDAL";
break;
case 2: cout << "\nStreaming Service Chosen: Amazon";
break;
case 3: cout << "\nStreaming Service Chosen: Apple Music";
break;
case 4: cout << "\nStreaming Service Chosen: Spotify";
break;
case 5: cout << "\nStreaming Service Chosen: YouTube";
break;
}

// printing the amount earned
cout << "\nAmount Earned: $" << earn;
}

OUTPUT:

case 1:

-----:Streaming Service Earning Finder:-----
Choose the Streaming Service Platform:
Enter 1 for TIDAL.
Enter 2 for Amazon.
Enter 3 for Apple Music.
Enter 4 for Spotify.
Enter 5 for YouTube.
Enter your choice: 4

Enter the name of the artist: Bob

Enter the name of the song: Beginning

Enter the number of streams: 450012

Artist: Bob
Song: Beginning
Streaming Service Chosen: Spotify
Amount Earned: $1966.55
Process returned 0 (0x0) execution time : 30.194 s
Press any key to continue.

case 2:

-----:Streaming Service Earning Finder:-----
Choose the Streaming Service Platform:
Enter 1 for TIDAL.
Enter 2 for Amazon.
Enter 3 for Apple Music.
Enter 4 for Spotify.
Enter 5 for YouTube.
Enter your choice: 10

Wrong Choice! Exiting the program!
Process returned 1 (0x1) execution time : 2.192 s
Press any key to continue.

case 3:

-----:Streaming Service Earning Finder:-----
Choose the Streaming Service Platform:
Enter 1 for TIDAL.
Enter 2 for Amazon.
Enter 3 for Apple Music.
Enter 4 for Spotify.
Enter 5 for YouTube.
Enter your choice: 2

Enter the name of the artist: Bob

Enter the name of the song: Beginning

Enter the number of streams: -42185

Number of streams can't be negative!
Process returned 1 (0x1) execution time : 14.224 s
Press any key to continue.

SCREENSHOTS:

HOPE THIS HELPS!

Add a comment
Know the answer?
Add Answer to:
You have been hired by an aspiring music artist to write a program that will help...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT