The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 337 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
Need some things added to this code feel free to change up anything you want. Its written in c++ . Add loops to validate data. Add a menu to your program that allows users to use the various features or exit the program. for a playlist program, you might have options to manage playlists, manage songs, display playlists, and so forth, or exit the program#include <iostream>
#include <cmath>
using namespace std;
enum Genre
{
Blues,
Rock,
Pop,
Jazz,
Unknown
};
class SongInfo
{
private:
string _name;
string _artist;
string _album;
Genre _g;
double _length;
public:
SongInfo()
{
}
void loadSongInfo(string name, string artist, string album, Genre g, double length)
{
_name = name;
_artist = artist;
_album = album;
_g = g;
_length = length;
}
Genre getSongGenre()
{
return _g;
}
void displaySongInfo()
{
cout << "Song Name:" << _name << endl;
cout << "Artist Name:" << _artist << endl;
cout << "Album Name:" << _album << endl;
string g;
switch (_g)
{
case Blues:
g = "Blues";
break;
case Rock:
g = "Rock";
break;
case Pop:
g = "Pop";
break;
case Jazz:
g = "Jazz";
break;
default:
g = "Unknown";
break;
}
cout << "Genre Name:" << g << endl;
cout << "Length in mins:" << _length << endl;
}
};
class Jocker
{
public:
// constructor
int calculatePaylist(int songLen, int numberOfSongs)
{
songLen = songLen;
numberOfSongs = numberOfSongs;
avPlayListlen = songLen * numberOfSongs;
return avPlayListlen;
}
// hidden data from outside world
int songLen;
int numberOfSongs;
int avPlayListlen;
};
int main()
{
int songlen;
int numOfSongs;
int i = 0;
Jocker a;
int counter = 2;
//Load Songs
//store in a collection
SongInfo songs[counter];
for (i = 0; i < counter; i++)
{
string name;
string artist;
string album;
Genre g;
double length;
cout << "Enter name of song (e.g. Last Day)" << endl;
cin >> name;
cout << "Enter name of arist (e.g. Taylor Swift)" << endl;
cin >> artist;
cout << "Enter name of album (e.g. Breaking Bad)" << endl;
cin >> album;
cout << "Enter genre - Blues = 1, Rock=2, Pop=3 and Jazz=4" << endl;
int choice = 0;
cin >> choice;
switch (choice)
{
case 1:
g = Blues;
break;
case 2:
g = Rock;
break;
case 3:
g = Pop;
break;
case 4:
g = Jazz;
break;
default:
g = Unknown;
break;
}
cout << "Enter length of song in minutes (e.g. 5.2)" << endl;
cin >> length;
songs[i].loadSongInfo(name, artist, album, g, length);
}
cout << "Listing all songs in your collection" << endl;
for (int i = 0; i < counter; i++)
{
songs[i].displaySongInfo();
}
cout << "List songs by genre - Blues = 1, Rock=2, Pop=3 and Jazz=4" << endl;
int choice = 0;
cin >> choice;
cout << "Listing songs " << endl;
for (int i = 0; i < counter; i++)
{
Genre g;
switch (choice)
{
case 1:
g = Blues;
break;
case 2:
g = Rock;
break;
case 3:
g = Pop;
break;
case 4:
g = Jazz;
break;
default:
g = Unknown;
break;
}
if (songs[i].getSongGenre() == g)
{
songs[i].displaySongInfo();
}
}
counter = 0;
while (counter < 9)
{
cout << "Enter the song Length" << endl;
std::cin >> songlen;
cout << "Enter number of Songs in the album" << endl;
std::cin >> numOfSongs;
int playList = a.calculatePaylist(songlen, numOfSongs);
cout << "Average Number of Album " << playList << endl;
counter++;
}
return 0;
}. If done ASAP ill give a big tip!!! please and thanks in advance!
----------- ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly