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!
You have been hired by an aspiring music artist to write a program that will help...