Computers and Technology, 15.08.2020 17:01 kolbehoneyman
Write Album's PrintSongsShorterThan() to print all the songs from the album shorter than the value of the parameter songDuration. Use Song's PrintSong() to print the songs.
#include
#include
#include
using namespace std;
class Song {
public:
void SetNameAndDuration(string songName, int songDuration) {
name = songName;
duration = songDuration;
}
void PrintSong() const {
cout << name << " - " << duration << endl;
}
string GetName() const { return name; }
int GetDuration() const { return duration; }
private:
string name;
int duration;
};
class Album {
public:
void SetName(string albumName) { name = albumName; }
void InputSongs();
void PrintName() const { cout << name << endl; }
void PrintSongsShorterThan(int songDuration) const;
private:
string name;
vector albumSongs;
};
void Album::InputSongs() {
Song currSong;
string currName;
int currDuration;
cin >> currName;
while (currName != "quit") {
cin >> currDuration;
currSong. SetNameAndDuration(currName, currDuration);
albumSongs. push_back(currSong);
cin >> currName;
}
}
void Album::PrintSongsShorterThan(int songDuration) const {
unsigned int i;
Song currSong;
cout << "Songs shorter than " << songDuration << " seconds:" << endl;
/* Your code goes here */
}
int main() {
Album musicAlbum;
string albumName;
getline(cin, albumName);
musicAlbum. SetName(albumName);
musicAlbum. InputSongs();
musicAlbum. PrintName();
musicAlbum. PrintSongsShorterThan(210);
return 0;
}
Answers: 3
Computers and Technology, 23.06.2019 09:00
Which company provides a crowdsourcing platform for corporate research and development? a: mtruk b: wiki answers c: mediawiki d: innocentive
Answers: 2
Computers and Technology, 23.06.2019 09:30
Why is an outfitting a workspace with video games in a technology development company considered a strategic use of money
Answers: 1
Write Album's PrintSongsShorterThan() to print all the songs from the album shorter than the value o...
Mathematics, 05.11.2019 08:31
Social Studies, 05.11.2019 08:31
Mathematics, 05.11.2019 08:31
Mathematics, 05.11.2019 08:31
Mathematics, 05.11.2019 08:31
Social Studies, 05.11.2019 08:31
Mathematics, 05.11.2019 08:31
German, 05.11.2019 08:31
Mathematics, 05.11.2019 08:31
Mathematics, 05.11.2019 08:31
Mathematics, 05.11.2019 08:31