Question: DO IT IN C + + Write Album's PrintSongsLongerThan ( ) member function to print all the songs from the album whose duration is longer
DO IT IN C Write Album's PrintSongsLongerThan member function to print all the songs from the album whose duration is longer than the
value of the parameter songDuration. Use Song's PrintSong member function to print a song. #include
#include
#include
using namespace std;
class Song
public:
void SetDurationAndNameint songDuration, string songName
duration songDuration;
name songName;
void PrintSong const
cout duration name endl;
int GetDuration const return duration;
string GetName const return name;
private:
int duration;
string name;
;
class Album
public:
void SetNamestring albumName name albumName;
void InputSongs;
void PrintName const cout name endl;
void PrintSongsLongerThanint songDuration const; private:
string name;
vector albumSongs;
;
void Album::InputSongs
Song currSong;
int currDuration;
string currName;
cin currDuration;
while currDuration
cin currName;
currSong.SetDurationAndNamecurrDuration currName;
albumSongs.pushbackcurrSong;
cin currDuration;
void Album::PrintSongsLongerThanint songDuration const
unsigned int i;
Song currSong;
cout "Songs longer than songDuration seconds:" endl;
Your code goes here
int main
Album musicAlbum;
string albumName;
getlinecin albumName;
musicAlbum.SetNamealbumName;
musicAlbum.InputSongs;
musicAlbum.PrintName;
musicAlbum.PrintSongsLongerThan;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
