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 34 35 void Album:: InputSongs() { 36 37 38 38 39 39 40 48 41 41 42 42 43 NO 44 T 45 49 46 40 47 } W 48 51 to 52 53 2 54 F 55 56 56 49 void Album::PrintSongs Longer Than (int songDuration) const { CO 50 30 unsigned int i; Song currSong; cout << "Songs longer than " << songDuration << " seconds:" << endl; /* Your code goes here / Song currSong; int currDuration; string currName; 62 63 24 €5 66 cin >> currDuration; - while (currDuration >= 0) { 67 cs } cin >> currName; currSong.Set DurationAndName(currDuration, currName); albumSongs.push_back (currSong); cin >> currDuration; 57 } 58 59 int main() { 60 61 Album musicAlbum; string albumName; getline (cin, albumName); musicalbur. Se Name (albumName) nesi-Albua IputSongs()l musicAlbum. PrintName(); Scanner musicAlbum.PrintSongs Longer Than (180);

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
What would be the missing line ?
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.
1 #include <iostream>
2 #include <string>
3 #include <vector>
4 using namespace std;
5
6 class Song {
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 };
22
CS S
public:
void Set DurationAndName(int songDuration, string songName) {
duration
songDuration;
name = songName;
}
void PrintSong() const {
cout << duration <<
" << name << endl;
}
int Get Duration() const { return duration; }
string GetName() const { return name; }
private:
int duration;
string name;
23 class Album {
24
25
26
27
28
29
30
31
public:
void SetName(string albumName) { name = albumName; }
void InputSongs();
void PrintName() const { cout << name << endl; }
void PrintSongs Longer Than (int songDuration) const;
ThunusimScanner.
private:
string name;
vector < Song> albumSongs;
34
35 void Album:: InputSongs() {
>
Transcribed Image Text: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. 1 #include <iostream> 2 #include <string> 3 #include <vector> 4 using namespace std; 5 6 class Song { 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 }; 22 CS S public: void Set DurationAndName(int songDuration, string songName) { duration songDuration; name = songName; } void PrintSong() const { cout << duration << " << name << endl; } int Get Duration() const { return duration; } string GetName() const { return name; } private: int duration; string name; 23 class Album { 24 25 26 27 28 29 30 31 public: void SetName(string albumName) { name = albumName; } void InputSongs(); void PrintName() const { cout << name << endl; } void PrintSongs Longer Than (int songDuration) const; ThunusimScanner. private: string name; vector < Song> albumSongs; 34 35 void Album:: InputSongs() { >
C
Write Album's PrintSongsLonger Than() 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.
34
35 void Album:: InputSongs() {
36
37
38
39
40
3
52
52
53
54
55
56
57 }
58
41
M
42
45
43
76
44
7
45
46
47 }
48
49 void Album::PrintSongs Longer Than (int songDuration) const {
50
unsigned int i;
51
51
Song currSong;
cout << "Songs longer than " << songDuration << " seconds:" << endl;
/* Your code goes here */
Song currSong;
int currDuration;
string currName;
61
62
63
4
65
66
cin >> currDuration; -
while (currDuration >= 0) {
67
68
}
cin >> currName;
currSong. Set DurationAndName (currDuration, currName);
59 int main() {
60
albumSongs.push_back(currSong);
cin >> curr Duration;
Album musicAlbum;
string albumName;
getline (cin, albumName);
MusicAlbum Se Name (albumName)
nusi-Album I putSongs)
Scanner
musicAlbum. PrintName()
musicAlbum. PrintSongs Longer Than (180);
2
Transcribed Image Text:C Write Album's PrintSongsLonger Than() 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. 34 35 void Album:: InputSongs() { 36 37 38 39 40 3 52 52 53 54 55 56 57 } 58 41 M 42 45 43 76 44 7 45 46 47 } 48 49 void Album::PrintSongs Longer Than (int songDuration) const { 50 unsigned int i; 51 51 Song currSong; cout << "Songs longer than " << songDuration << " seconds:" << endl; /* Your code goes here */ Song currSong; int currDuration; string currName; 61 62 63 4 65 66 cin >> currDuration; - while (currDuration >= 0) { 67 68 } cin >> currName; currSong. Set DurationAndName (currDuration, currName); 59 int main() { 60 albumSongs.push_back(currSong); cin >> curr Duration; Album musicAlbum; string albumName; getline (cin, albumName); MusicAlbum Se Name (albumName) nusi-Album I putSongs) Scanner musicAlbum. PrintName() musicAlbum. PrintSongs Longer Than (180); 2
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education