Unformatted text preview:

MAIN Driver include iostream include playlist h using namespace std void ShowMenu int main Playlist p make a new object bool invalid false for testing loop bool exitProg false flag to exit char choice 0 initializing ShowMenu outputs menu do cin choice choice toupper choice converts value to upper case choosing menu switch choice case A adds song to playlist char title 36 char artist 21 char type int songSize song get inputs cout Enter the song title cin ignore cin getline title 50 cout Enter the song artist cin getline artist 50 cout Enter the catagory of the song n cout P op R ock A lternative C ountry H iphop or Parod Y cin type cout Enter the size of the song in kb cin songSize p AddSong title artist type songSize adds the break case F Finds song on playlist char srchString 35 cout Type the Title of a song or the name of an artist to search for n cin srchString p FindSong srchString looks for the string break case D deletes song from playlist char delSong 35 cout Type name of song to be removed cin delSong p DeleteSong delSong removes the song if found break case S show the entire playlist p ShowPlaylist displays palylist break case C catagory summary char catInput A lternative n category cout Choose a category P op R ock C ountry H iphop or Parod Y cin catInput p CategorySummary catInput prints out summary of a break case Z show playlist size p ShowSize shows entire pallsit size break case M show this menu ShowMenu displays menu break case O p Sort break case X exits the program cout Exiting program exitProg true break default invalid true cout choice is not a valid choice n cout nPlease choose a valid selection from the menu n break while invalid exitProg A F D S C Z M X void ShowMenu cout Choose from the following menu n Add a song to the playlist n Find a song Artist on the playlist n Delete a song from the playlist n Show the entire playlist n Category summary n Show playlist size n Show this Menu n Exit the program n endl include iostream include playlist h using namespace std void ShowMenu int main Playlist p make a new object bool invalid false for testing loop bool exitProg false flag to exit char choice 0 initializing ShowMenu outputs menu do cin choice choice toupper choice converts value to upper case choosing menu switch choice case A adds song to playlist char title 36 char artist 21 char type int songSize get inputs cout Enter the song title cin ignore cin getline title 50 cout Enter the song artist cin getline artist 50 cout Enter the catagory of the song n cout P op R ock A lternative C ountry H iphop or Parod Y cin type cout Enter the size of the song in kb cin songSize p AddSong title artist type songSize adds the break case F Finds song on playlist char srchString 35 cout Type the Title of a song or the name of an artist to search for n cin srchString p FindSong srchString looks for the string break case D deletes song from playlist char delSong 35 cout Type name of song to be removed cin delSong p DeleteSong delSong removes the song if found break case S show the entire playlist p ShowPlaylist displays palylist break case C catagory summary char catInput cout Choose a category P op R ock C ountry H iphop or Parod Y cin catInput p CategorySummary catInput prints out summary of a break case Z show playlist size p ShowSize shows entire pallsit size break case M show this menu ShowMenu displays menu break case O p Sort break case X exits the program cout Exiting program exitProg true break default song A lternative n category invalid true cout choice is not a valid choice n cout nPlease choose a valid selection from the menu n break while invalid exitProg A F D S C Z M X void ShowMenu cout Choose from the following menu n Add a song to the playlist n Find a song Artist on the playlist n Delete a song from the playlist n Show the entire playlist n Category summary n Show playlist size n Show this Menu n Exit the program n endl END MAIN H ifndef SONG H define SONG H enum Style POP ROCK ALTERNATIVE COUNTRY HIPHOP PARODY class Song public Song default constructor sets up blank song object void Set const char t const char a Style st int sz 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 object const char GetArtist const int GetSize const Style GetCategory const returns the title stored in the returns the artist returns the file size in bytes returns the song category void Display const described below private char title 36 may assume title is 35 characters or less char artist 21 Style category style of the given song int size file size stored in bytes may assume artist name is 20 characters or less Display function The member function Display 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 bytes 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 include song h class Playlist public Playlist constructor Playlist destructor void AddSong char char char int void DeleteSong char void FindSong char const void ShowPlaylist const void CategorySummary char float ShowSize const void Sort const void Grow private int maxSize int currentSize Song songList song object END H CPP include iostream include cstring include iomanip include playlist h using namespace std contructor Playlist Playlist initialize variables maxSize 5 currentSize 0 songList new Song maxSize create a new song object destructor Playlist Playlist delete songList memory management adds song to palylist void Playlist AddSong char t char a char c int s Style style c toupper c switch c case A style ALTERNATIVE break case C case H style COUNTRY break style HIPHOP break case P case R style POP break style ROCK break case Y style PARODY break default if invalid choose one for them cout Invalid category Defaulting to Alternative n style ALTERNATIVE break if currentSize maxSize Grow songList currentSize Set t a style s sets the values deletes song from playlist void Playlist DeleteSong char d loop through find a match and delete it for


View Full Document

FSU COP 3330 - Notes

Download Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?