8.3 Design a musical jukebox using object-oriented principles.
Careercup This book is really irresponsible, wrote a half-tone program, said the full version can also be downloaded to, but how I can't find, who know where to download please tell the blogger, thank you ~
classSong;classCD { Public: // ...Private: Long_id; string_artist; Set<Song>_songs;};classSong { Public: // ...Private: Long_id; CD _CD; string_title; Long_length;};classPlaylist { Public: Playlist () {}; Playlist (song song, Queue<Song>queue): _song (song), _queue (queue) {}; Song Getnextstoplay () {Song Next=_queue.front (); _queue.pop (); returnNext; } voidQueueupsong (Song s) {_queue.push (s); } Private: Song _song; Queue<Song>_queue;};classCDPlayer { Public: CDPlayer (CD C, Playlist p): _c (c), _p (p) {}; CDPlayer (Playlist P): _p (P) {}; CDPlayer (CD C): _c (c) {}; voidPlaysong (Song s) {};// ...Playlist Getplaylist () {return_p;}; voidSetplaylist (Playlist p) {_p =p;}; CD Getcd () {return_c;}; voidSETCD (CD c) {_c =c;}; Private: Playlist _p; CD _c;};classUser { Public: User (stringNameLongID): _name (name), _id (id) {}; stringGetnmae () {return_name;}; voidSetName (stringName) {_name =name;}; LongGetID () {return_id;}; voidSetID (LongID) {_id =ID;}; User GetUser () {return* This; }; StaticUser AddUser (stringNameLongID) {};// ... Private: string_name; Long_id;};classSongselector { Public: Song Getcurrentsong () {};// ...};classJukebox { Public: Jukebox (cdplayer cdplayer, user user,Set<CD>cdcollection, Songselector ts): _cdplayer (CDPlayer), _user (user), _cdcollection (cdcollection), _ts (ts) {}; Song Getcurrentsong () {return_ts.getcurrentsong (); } voidSetUser (User u) {_user=u; } Private: CDPlayer _cdplayer; User _user; Set<CD>_cdcollection; Songselector _ts;};
[Careercup] 8.3 musical Jukebox Jukebox