Song Playlist
You will be writing classes that implement a simulation of a playlist for a digital musicdevice. The list will be a dynamic array of Song objects, each of which stores several piecesof information about a song. You will need to finish the writing of two classes: Song andPlaylist. The full header file for the Song class has been provided in a file called song.h.
Program Details and Requirements
1) Using the Song class declaration, write the song.cpp file and define all of the memberfunctions that are declared in the file song.h. Notice that there areonly six categories of songs in this class: POP, ROCK, ALTERNATIVE, COUNTRY,HIPHOP, and PARODY. The expected functions behaviors are described in the commentsof this header file.
2) Write a class called Playlist (filenames are playlist.hand playlist.cpp). A Playlistobject should contain a list of songs. There is no size limit to the song list, so it should beimplemented with a dynamically allocated array. You can add any public or private functions into the Playlist class that you feel arehelpful. In addition to the Playlist class itself, you will also create a menu program tomanage the playlist. Note that the Playlist class should provide most of the functionality —
as the idea is to build a versatile and reusable class. The menu program you write is just fortesting purposes, so the major functionality will be in the Playlist class itself. The Playlistmember functions will be the interface betwen this menu program and the internally stored
data (the list of songs).
Rules for the Playlist class:
All member data of class Playlist must be private. There should be no cinstatements inside the Playlist class member functions. Toensure the class is more versatile, any user input (i.e. keyboard) described in the menuprogram below should be done in the menu program itself. Design the Playlist classinterface so that any items of information from outside the class are received throughparameters of the public member functions.
The list of Songs must be implemented with a dynamically allocated array. Betweencalls to Playlist member functions, there should never be more than 5 unused slots inthis array. This means that you will need to ensurethat the array allocation expands or shrinks at appropriate times. Whenever the array isresized, print a message that states that the array is being resized,and what the new size is. Example: “** Array being resized to 10 allocated slots”.
Since dynamic allocation is being used inside the Playlist class, an appropriatedestructor must be defined, to clean up memory. The class must not allow any memoryleaks.
You must use the constqualifier in all appropriate places (const member functions,const parameters, const returns, where appropriate).
3) Write a main program (filename menu.cpp) that creates a single Playlist object and then
implements a menu interface to allow interaction with the object. Your main program should
implement the following menu loop (any single letter options should work on both lower
and upper case inputs):
A: Add a song to the playlist
F: Find a song on the playlist
D: Delete a song from the playlist
S: Show the entire playlist
C: Category summary
Z: Show playlist size
M: Show this Menu
X: eXit the program
Behavior of menu selections:
Always ask for user input in the order specified. Remember, all user inputs described inthe menu options below should be done by the menu program.Such input can then be sent into the Playlist class — the Playlist class member functionsshould do most of the actual work, since they will have access to the list of songs. For alluser inputs (keyboard), assume the following:
a song title and artist will always be input as c-strings (c-style strings), of maximumlengths 35 and 20, respectively. You may assume that the user will not enter morecharacters than the stated limits for these inputs.
when asking for the category, user entry should always be a single character. Thecorrect values are P, R, A, C, H, and Y – for Pop, Rock, Alternative, Country, HipHop,and Parody, respectively. Uppercase and lowercase inputs should both be accepted.
Whenever the user enters any other character for the category, this is an error — print an
error message and prompt the user to enter the data again.
User input of the size should be a positive int, in kilobytes. You may assume that theuser will enter an integer. Whenever the user enters a number that is not positive, it isconsidered an error — so an error message should be printed and the user should beprompted to re-enter the size. (Example: “Must enter a positive size. Please re-enter: “).
User input of menu options are letters, and both upper and lower case entries should be
allowed.
A: This menu option should allow the adding of a song to the playlist. The user will need to
type in the song’s information. Prompt and allow the user to enter the information in the
following order: title, artist, category, size. The information should be sent into the Playlist
object and stored in the list of songs.
F: This option should allow the user to search for a song in the playlist by title or by artist.
When this option is selected, ask the user to enter a search string. If the search string matches a song title, display theinformation for that song. If the search string matches an artist/group in the list, display theinformation for all songs by that artist. If no matching songs are found in the search,
display an appropriate message informing the user that there were no results in the playlist.
D: This option should delete a song from the playlist. When this option is selected, ask theuser to type in the title of the song. Remove this song from the playlist. If there is no such title, inform the user andreturn to the menu.
S: This option should simply print the entire playlist to the screen, one line per song, in an
organized manner (like a table). Each line should contain one song’s information, asdescribed in the song.hfile. Also, display the total number of songs in the playlist, as wellas the total size of the playlist (in Megabytes, to 2 decimal places).
C: This option should list the playlist contents for one specific category. When this option is
selected, ask the user to input a category to print. For the category selected, print out the
contents of the playlist, as in the Show option, but for the songs matching the selected
category only. (e.g. list all of the Pop songs). After this, also display the total quantity, as
well as the total file size (the sum of the sizes), taken up by songs in this category. Print this
size in Megabytes to 2 decimal places.
Z: This option should compute and print the total file storage taken up by the playlist,printed out in kilobytes.
M: Re-display the menu.
X: Exit the menu program.
5) General Requirements:
All class member data must be private
ALL string usages in this assignment are to be implemented with C-style strings (i.e.null-terminated character arrays). You may NOT use the C++ string class library. Alarge point of this assignment is to do your own dynamic memory allocation andmanagement, as well as to practice with fixed size C-strings.
An invalid menu selection should produce an appropriate output message to the user,
like “Not a valid option, choose again.”
For all of these options, any output to the screen should be user-friendly. By this, assumethat the user of the program has never seen it before. All output should clearly indicatewhat information is being presented, and the user should always be told what isexpected in terms of input.
You may use the following libraries: iostream, iomanip, cstring, cctype
// Bob Myers
//
// song.h — header file for the Song class
//
// An object of type Song will store information
about a single
// digitally recorded song file.
// The variable “category” stores the category of
the song
// (one of the six items in the enumerated typeStyle).
#include
using namespace std;
#ifndef _SONG_H
#define _SONG_H
enum Style {POP, ROCK, ALTERNATIVE, COUNTRY,
HIPHOP, PARODY};
class Song
{
// operator overload — described at bottom
friend ostream& operator<<(ostream&os, const
Song& s);
public:
Song(); // default constructor,
sets up blank song object
void Set(const char* t, const char* a, Style st,intsz);
// the Set function should allow incoming data tobe received through
// parameters and loaded into the member data ofthe object. (i.e.
// this function “sets” the state of the object
to the data passed in).
// The parameters t, a, st, and sz represent the
title, artist, style,
// and size of the song file, respectively.
const char* GetTitle() const; // returnsthe title stored in the object
const char* GetArtist() const; // returnsthe artist
intGetSize() const; // returns
the file size in kilobytes
Style GetCategory() const; // returnsthe song category
private:
char title[36]; // may assume title is 35characters or less
char artist[21]; // may assume artist nameis 20 characters or less
Style category; // style of the given song
int size; // file size, stored inkilobytes
};
/* operator<< function
The operator<< overload should print out a Song
object on one line (tothe given ostream) — use no more than 80
characters per line – asfollows, in an organized manner. Size should beprinted in Megabytes
(use 1000 kilobytes = 1 MB for this calculation),to 1 decimal place.
The category abbreviations used should be: Pop,Rock, Alt, Ctry, HH, Par
Title Artist
Style Size (MB)
Examples:
Pictures of You The Cure
Alt 4.4
Bohemian Rhapsody Queen
Rock 5.7
What Does the Fox Say Ylvis
Par 12.6
*/
#endif
Solution
Menu.cpp
// An object of type Song will store information about a single
// digitally recorded song file.
#include
#include “song.h”
#include “playlist.h”
#include
using namespace std;
//ShowMenu()
voidShowMenu()
{
cout<< ” *** Playlist Menu *** ” << ‘\n’;
cout<< “\tA or a \tAdd a song to the playlist” << ‘\n’;
cout<< “\tF or f \tFind a song on the playlist” << ‘\n’;
cout<< “\tD or d \tDelete a song from the playlist” << ‘\n’;
cout<< “\tS or s \tShow the entire playlist” << ‘\n’;
cout<< “\tC or c \tCategory summary” << ‘\n’;
cout<< “\tZ or z \tShow playlist size” << ‘\n’;
cout<< “\tM or m \tShow this Menu” << ‘\n’;
cout<< “\tO or o \tsOrt playlist” << ‘\n’;
cout<< “\tX or x \teXit the program” << ‘\n’;
}
//GetChar()
charGetAChar(const char* promptString)
{
char response; // the char to be returned
cout<
cin>> response; // Get a char,
response = toupper(response); // and convert it to uppercase
cin.get(); // Discard newline char from input.
return response;
}
// Legal()
char Legal(char c)
{
return ((c == ‘A’) || (c == ‘F’) || (c == ‘D’) || (c == ‘S’) ||
(c == ‘C’) || (c == ‘Z’) || (c == ‘M’) || (c == ‘X’) ||
(c == ‘a’) || (c == ‘f’) || (c == ‘d’) || (c == ‘s’) ||
(c == ‘c’) || (c == ‘z’) || (c == ‘m’) || (c == ‘x’) ||
(c == ‘O’) || (c == ‘o’));
}
//GetCommand()
charGetCommand()
{
charcmd = GetAChar(“\n\n>”); // Get a command character.
while (!Legal(cmd)) { // As long as it’s not a legal command,display menu and try again.
cout<< “\nIllegal command, please try again . . .” << ‘\n’;
ShowMenu();
cmd = GetAChar(“\n\n>”);
}
returncmd;
}
//GetInput()
voidGetInput(Song& song)
{
char t[36];
char a[21];
Style c;
chartempStyle; //to read in Style
int s = 0;
cout<< “Enter a song title: ” <
cin.getline(t, 36);
cout<< “Enter a song artist: ” <
cin.getline(a, 21);
cout<< “Enter a song category: ” <
cout<< “(P = pop, R = rock, A = alternative, C = country, H = hiphop, Y = parody)” <
cin>>tempStyle;
while (tempStyle != ‘P’ &&tempStyle != ‘p’ &&tempStyle != ‘R’ &&tempStyle != ‘r’ &&
tempStyle != ‘A’ &&tempStyle != ‘a’ &&tempStyle != ‘C’ &&tempStyle != ‘c’ &&
tempStyle != ‘H’ &&tempStyle != ‘h’ &&tempStyle != ‘Y’ &&tempStyle != ‘y’) {
cout<< “Invalid category. Please re-enter: ” <
cin>>tempStyle;
}
if (tempStyle == ‘P’ || tempStyle == ‘p’) {
c = POP;
}
else if (tempStyle == ‘R’ || tempStyle == ‘r’) {
c = ROCK;
}
else if (tempStyle == ‘A’ || tempStyle == ‘a’) {
c = ALTERNATIVE;
}
else if (tempStyle == ‘C’ || tempStyle == ‘c’) {
c = COUNTRY;
}
else if (tempStyle == ‘H’ || tempStyle == ‘h’) {
c = HIPHOP;
}
else if (tempStyle == ‘Y’ || tempStyle == ‘y’) {
c = PARODY;
}
else {
cout<< “Invalid category. Please re-enter: ” <
}
cin.ignore();
while (s <= 0) {
cout<< “Enter a song size (kb): ” <
cin>> s;
if (s <= 0) {
cout<< “Must enter a positive size. Please re-enter: ” <
}
}
song.Set(t, a, c, s);
}
// main()
int main()
{
Playlist p;
char command;
do {
ShowMenu();
Song song;
charlookupString[36];
command = GetCommand();
switch (command) {
case ‘A’:
GetInput(song);
p.Insert(song);
break;
case ‘F’:
cout<< “\tType a SONG TITLE or ARTIST to be searched, followed by : “;
cin.getline(lookupString, 36);
p.Lookup(lookupString); break;
case ‘D’:
cout<< “\nType name to be removed, followed by : “;
cin.getline(lookupString, 36);
p.Remove(lookupString);
break;
case ‘S’:
p.DisplayPlaylist();
p.ShowPlaylistSize();
break;
case ‘C’:
cout<< ” Please enter category: ” << ‘\n’;
cin.getline(lookupString, 36);
p.DisplayPlaylistCategory(lookupString);
; break;
case ‘Z’: p.ShowPlaylistSizeKB(); break;
case ‘M’: ShowMenu(); break;
case ‘O’: p.SortSong(); p.DisplayPlaylist(); break;
case ‘X’: break;
case ‘a’:
GetInput(song);
p.Insert(song);
break;
case ‘f’:
cout<< “\tType a SONG TITLE or ARTIST to be searched, followed by : “;
cin.getline(lookupString, 36);
p.Lookup(lookupString); break;
case ‘d’:
cout<< “\nType name to be removed, followed by : “;
cin.getline(lookupString, 36);
p.Remove(lookupString);
break;
case ‘s’: p.DisplayPlaylist(); break;
case ‘c’:
cout<< ” Please enter category: ” << ‘\n’;
cin.getline(lookupString, 36);
p.DisplayPlaylistCategory(lookupString);
break;
case ‘z’: p.ShowPlaylistSizeKB(); break;
case ‘m’: ShowMenu(); break;
case ‘o’: p.SortSong(); p.DisplayPlaylist(); break;
case ‘x’: break;
default: break;
}
} while (command != ‘X’ && command != ‘x’);
return 0;
}
Playlist.cpp
#include
#include
#include “playlist.h”
#include
#include
#include
// Default constructer
Playlist::Playlist()
{
maxSize = 5;
currentSize = 0;
songList = new Song[maxSize];
}
// Destructor
Playlist::~Playlist()
{
delete[] songList;
}
// Insert()
void Playlist::Insert(Song& song)
/* since the variables being passed in the */
{
if (currentSize == maxSize) {
Resize();
}
songList[currentSize++] = song; //implicity calls songList[currentSize++]’s defaul constructor before assigning song into that element
}
// Lookup()
void Playlist::Lookup(char* aName) const
{
inttitleEntry = FindSongbyTitle(aName); // Locate the name in the directory.
intartistEntry = FindSongbyArtist(aName); // Locate the name in the directory.
if (titleEntry == -1 &&artistEntry == -1) {
cout<
}
else {
if (titleEntry != -1) {
//at this point, aName, the SONG TITLE found in playlist
cout<< “\nEntry found: “;
cout<
}
if (artistEntry != -1) {
cout<< “\nEntry found: “;
for (int i = 0; i
if (strcmp(songList[i].GetArtist(), aName) == 0) {
cout<
}
}
}
}
}
// Remove()
void Playlist::Remove(char* aName)
{
intthisEntry = FindSong(aName); // Locate the name in the directory.
if (thisEntry == -1)
cout<
else {
// Shift each succeding element “down” one position in the
// Entry array, thereby deleting the desired entry.
for (int j = thisEntry + 1; j
songList[j – 1] = songList[j];
currentSize–; // Decrement the current number of entries.
cout<< “Entry removed.\n”;
}
if (maxSize>= currentSize + 6) {
//maxSize
Resize();
}
}
// DisplayPlaylist()
void Playlist::DisplayPlaylist() const
{
if (currentSize == 0) {
cout<< “\nCurrent playlist is empty.\n”;
return;
}
// Display a header.
cout<< “\n\t***Title***\t\t\t***Artist***\t\t***Style***\t\t***Size (MB)***\n\n”;
for (int i = 0; i
cout<
}
// DisplayPlaylistCategory()
void Playlist::DisplayPlaylistCategory(char* cat) const
{
intoriginalPrecision = cout.precision();
if (currentSize == 0) {
cout<< “\nCurrent playlist is empty.\n”;
return;
}
// Display a header.
cout<< “\n\t***Title***\t\t\t***Artist***\t\t***Style***\t\t***Size (MB)***\n\n”;
doublesumSize(0);
intnumSongs(0);
for (int i = 0; i
Style style = songList[i].GetCategory();
char temp = ‘ ‘;
//P, R, A, C, H, and Y
if (style == POP) {
temp = ‘P’;
}
else if (style == ROCK) {
temp = ‘R’;
}
else if (style == ALTERNATIVE) {
temp = ‘A’;
}
else if (style == COUNTRY) {
temp = ‘C’;
}
else if (style == HIPHOP) {
temp = ‘H’;
}
else if (style == PARODY) {
temp = ‘Y’;
}
else {
cout<< “Invalid category.” << ‘\n’;
}
//at this point cat variable is all uppercase
if (temp == toupper(cat[0])) {
cout<
sumSize += songList[i].GetCategory();
numSongs++;
}
}
cout<< “Total size of playlist: ” <(sumSize / 1000)
<
cout<
}
// Resize()
void Playlist::Resize()
{
maxSize = currentSize + 5;
Song* newList = new Song[maxSize];
for (int i = 0; i
{
newList[i] = songList[i];
}
delete[] songList;
songList = newList;
cout<< “Array is being resized to ” <
}
// FindSongbyTitle()
int Playlist::FindSongbyTitle(char* aName) const
// Locate a name in the directory. Returns the
// position of the entry list as an integer if found.
// and returns -1 if the entry is not found in the directory.
{
for (int i = 0; i
// make both the database song name and search song name uppercase for proper matching
int j = 0;
char* songList_song = const_cast(songList[i].GetTitle());
char c;
while (songList_song[j]) {
c = songList_song[j];
c = toupper(c);
songList_song[j] = c;
j++;
}
int k = 0;
char* search_song = const_cast(aName);
char d;
while (search_song[k]) {
d = search_song[k];
d = toupper(d);
search_song[k] = d;
k++;
}
if (strcmp(songList_song, search_song) == 0) {
return i; // If found, return position and exit.
}
}
return -1; // Return -1 if never found.
}
// FindSongbyArtist()
int Playlist::FindSongbyArtist(char* aName) const
// Locate a name in the directory. Returns the
// position of the entry list as an integer if found.
// and returns -1 if the entry is not found in the directory.
{
for (int i = 0; i
// make both the database song name and search song name uppercase for proper matching
int j = 0;
const char* songList_artist = songList[i].GetArtist();
char* songList_artist2 = const_cast(songList_artist);
char c;
while (songList_artist2[j]) {
c = songList_artist2[j];
c = toupper(c);
songList_artist2[j] = c;
j++;
}
int k = 0;
char* search_artist = aName;
char d;
while (search_artist[k]) {
d = search_artist[k];
d = toupper(d);
search_artist[k] = d;
k++;
}
if (strcmp(songList_artist2, search_artist) == 0)
return i; // If found, return position and exit.
}
return -1; // Return -1 if never found.
}
// FindSong()
int Playlist::FindSong(char* aName) const
// Locate a name in the directory. Returns the
// position of the entry list as an integer if found.
// and returns -1 if the entry is not found in the directory.
{
for (int i = 0; i
if ((strcmp(songList[i].GetTitle(), aName)) == 0 || (strcmp(songList[i].GetArtist(), aName) == 0))
return i; // If found, return position and exit.
}
return -1; // Return -1 if never found.
}
void Playlist::ShowPlaylistSize()
{
intoriginalPrecision = cout.precision();
double sum = 0;
cout<< “Total no. of songs in playlist: ” <
for (int i = 0; i
sum = sum + songList[i].GetSize();
}
cout<< “Total size of playlist: ” <(sum / 1000)
<
cout<< ‘\n’;
}
void Playlist::ShowPlaylistSizeKB()
{
int sum = 0;
for (int i = 0; i
sum = sum + songList[i].GetSize();
}
cout<< “Total size of playlist: ” << sum << ‘\n’;
cout<< ‘\n’;
}
// SortSong()
void Playlist::SortSong()
{
cout<< “\tA or a \tSort playlist via Artist” << ‘\n’;
cout<< “\tT or t \tSort playlist via Title” << ‘\n’;
cout<< “\n> “;
charcmd; // the char to be returned
cin>>cmd; // Get a char,
cmd = toupper(cmd); // and convert it to uppercase
cin.get(); // Discard newline char from input.
if (cmd == ‘A’)
SortSongbyArtist();
else if (cmd = ‘T’)
SortSongbyTitle();
else
cout<< “Invalid input. Back to main menu.”<< ‘\n’;
}
// SortSongbyArtist
void Playlist::SortSongbyArtist()
{
for (int i = 0; i
{
for (int j = i; j
{
if (strcmp(songList[i].GetArtist(), songList[j].GetArtist()) > 0) //need to sort
{
//swap song infomation
Song tempSong;
tempSong.Set(songList[i].GetTitle(), songList[i].GetArtist(), songList[i].GetCategory(), songList[i].GetSize());
songList[i].Set(songList[j].GetTitle(), songList[j].GetArtist(), songList[j].GetCategory(), songList[j].GetSize());
songList[j].Set(tempSong.GetTitle(), tempSong.GetArtist(), tempSong.GetCategory(), tempSong.GetSize());
}
}
}
}
//SortSongbyTitle()
void Playlist::SortSongbyTitle()
{
for (int i = 0; i
{
for (int j = i; j
{
if (strcmp(songList[i].GetTitle(), songList[j].GetTitle()) > 0) //need to sort
{
//swap song infomation
Song tempSong;
tempSong.Set(songList[i].GetTitle(), songList[i].GetArtist(), songList[i].GetCategory(), songList[i].GetSize());
songList[i].Set(songList[j].GetTitle(), songList[j].GetArtist(), songList[j].GetCategory(), songList[j].GetSize());
songList[j].Set(tempSong.GetTitle(), tempSong.GetArtist(), tempSong.GetCategory(), tempSong.GetSize());
}
}
}
}
Playlist.h
// An object of type Song will store information about a single
// digitally recorded song file.
#pragma once
#include
#include “song.h”
using namespace std;
class Playlist
{
public:
Playlist();
~Playlist();
void Insert(Song& song);
void Lookup(char* aName) const;
void Remove(char* aName);
voidDisplayPlaylist() const;
voidDisplayPlaylistCategory(char* cat) const;
voidShowPlaylistSize();
voidShowPlaylistSizeKB();
voidSortSong();
private:
intmaxSize;
intcurrentSize;
Song* songList;
void Resize();
intFindSong(char* aName) const;
intFindSongbyTitle(char* aName) const;
intFindSongbyArtist(char* aName) const;
voidSortSongbyTitle();
voidSortSongbyArtist();
};
Song.cpp
#include
#include “song.h”
#include
#ifndef _SONG_CPP
#define _SONG_CPP
using namespace std;
// default constructor, sets up blank song object
Song::Song()
{
strcpy(title, ” “);
strcpy(artist, ” “);
size = 0;
}
// Set()
void Song::Set(const char* t, const char* a, Style st, intsz)
{
strcpy(title, t);
strcpy(artist, a);
category = st;
size = sz;
}
// GetTitle()
const char* Song::GetTitle() const
{
return title;
}
// GetArtist()
const char* Song::GetArtist() const
{
return artist;
}
// GetSize()
int Song::GetSize() const
{
return size;
}
// GetCategory()
Style Song::GetCategory() const
{
return category;
}
// Display()
ostream& operator<<(ostream&os, const Song& s)
{
os<< ‘\t’ <
for (int i = strlen(s.GetTitle()) + 1; i < 36; i++)
os.put(‘ ‘);
os<< ‘\t’ <
for (int i = strlen(s.GetArtist()) + 1; i < 21; i++)
os.put(‘ ‘);
//cout<< ‘\t’ << category;
if (s.GetCategory() == 0)
{
os<< ‘\t’ << “Pop”;
}
else if (s.GetCategory() == 1) {
os<< ‘\t’ << “Rock”;
}
else if (s.GetCategory() == 2) {
os<< ‘\t’ << “Alternative”;
}
else if (s.GetCategory() == 3) {
os<< ‘\t’ << “Country”;
}
else if (s.GetCategory() == 4) {
os<< ‘\t’ << “Hip Hop”;
}
else if (s.GetCategory() == 5) {
os<< ‘\t’ << “Parody”;
}
else {
os<< ‘\t’ << “Wrong Input”;
}
os<< ‘\t’ <(static_cast(s.GetSize()) / 1000);
os<< ‘\n’ << ‘\n’;
returnos;
}
#endif
Song.h
#pragma once
// An object of type Song will store information about a single
// digitally recorded song file.
// The variable “category” stores the category of the song
// (one of the six items in the enumerated type Style).
#include
using namespace std;
#ifndef _SONG_H
#define _SONG_H
enum Style { POP, ROCK, ALTERNATIVE, COUNTRY, HIPHOP, PARODY };
class Song
{
// operator overload — described at bottom
friendostream& operator<<(ostream&os, const Song& s);
public:
Song(); // default constructor, sets up blank song object
void Set(const char* t, const char* a, Style st, intsz);
// the Set function should allow incoming data to be received through
// parameters and loaded into the member data of the object. (i.e.
// this function “sets” the state of the object to the data passed in).
// The parameters t, a, st, and sz represent the title, artist, style,
// and size of the song file, respectively.
const char* GetTitle() const; // returns the title stored in the object
const char* GetArtist() const; // returns the artist
intGetSize() const; // returns the file size in kilobytes
Style GetCategory() const; // returns the song category
private:
char title[36]; // may assume title is 35 characters or less
char artist[21]; // may assume artist name is 20 characters or less
Style category; // style of the given song
int size; // file size, stored in kilobytes
};
/* operator<< function
The operator<< overload should print out a Song object on one line
(use no more than 80 characters per line) as follows, in an organized
manner. Size should be printed in Megabytes (use 1000 kilobytes = 1 MB
for this calculation), to 1 decimal place. The category abbreviations
used should be: Pop, Rock, Alt, Ctry, HH, Par
Title Artist Style Size (MB)
Examples:
Pictures of You The Cure Alt 4.4
Bohemian Rhapsody Queen Rock 5.7
What Does the Fox Say Ylvis Par 12.6
Output:
Bohemian Rhapsody Queen 0 46
*/
#endif