subject

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;
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:00
Which of the following kinds of programs displays an online advertisement in a banner or pop-up window on webpages, email, or other internet service? e
Answers: 2
question
Computers and Technology, 22.06.2019 18:30
What is outfitting a workplace with video in a technology
Answers: 2
question
Computers and Technology, 23.06.2019 02:00
Consider the following function main: int main() { int alpha[20]; int beta[20]; int matrix[10][4]; . . } a. write the definition of the function inputarray that prompts the user to input 20 numbers and stores the numbers into alpha. b. write the definition of the function doublearray that initializes the elements of beta to two times the corresponding elements in alpha. make sure that you prevent the function from modifying the elements of alpha. c. write the definition of the function copyalphabeta that stores alpha into the first five rows of matrix and beta into the last five rows of matrix. make sure that you prevent the function from modifying the elements of alpha and beta. d. write the definition of the function printarray that prints any onedimensional array of type int. print 15 elements per line. e. write a c11 program that tests the function main and the functions discussed in parts a through d. (add additional functions, such as printing a two-dimensional array, as needed.)
Answers: 3
question
Computers and Technology, 23.06.2019 05:20
Which operating system is a version of linux?
Answers: 1
You know the right answer?
Write Album's PrintSongsShorterThan() to print all the songs from the album shorter than the value o...
Questions
question
Mathematics, 08.10.2019 10:50
Questions on the website: 13722362