
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
What will be the missing line code?

Transcribed Image Text:Write code to read a list of song durations and song names from input. For each line of input, set the duration and name of
newSong. Then add newSong to songsList. Input first receives a song duration, then the name of that song (which you can
assume is only one word long). Input example:
424 Time
383 Money
-1
1 #include <iostream>
2 #include <string>
3 #include <vector>
4 using namespace std;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
class Song {
public:
void Set DurationAndName(int songDuration, string songName) {
duration songDuration;
name songName;
30
31
32
}
void PrintSong() const {
11
cout << duration <<
<<name << endl;
}
int GetDuration () const { return duration; }
string GetName() const { return name; }
private:
int duration;
string name;
21 };
22
23 int main() {
24
25
26
27
28
29
vector<Song> songsList;
Song newSong;
int songDuration;
string songName;
unsigned int i;
cin >>songDuration;
while (songDuration >= 0) {
33
/* Your code goes here */
34 newSong. Set DurationAndName (songDuration, songName);
35 playlist.push_back (newSong) ;|
2
CS Scanned with CamScanner
Check
Try again

Transcribed Image Text:Jump to level 1
Write code to read a list of song durations and song names from input. For each line of input, set the duration and name of
newSong. Then add newSong to songsList. Input first receives a song duration, then the name of that song (which you can
assume is only one word long). Input example:
424 Time
383 Money
-1
11
12
13
14
15
16
17
18
19
20
21 };
22
25
26
27
28
29
30
31
32
33
23 int main() {
24
37
38
}
void PrintSong() const {
cout << duration << " - " << name << endl;
39
40
41
42
}
int GetDuration () const { return duration; }
string GetName() const { return name; }
private:
45}
int duration;
string name;
vector<Song> songsList;
/* Your code goes here */
34 newSong. Set DurationAndName (songDuration, songName);
35 playlist.push_back (newSong) ;|
36
cin>> songDuration;
Song newSong;
int songDuration;
string songName;
unsigned int i;
cin >> songDuration;
while (songDuration >= 0) {
}
for (i = 0; i < songsList.size(); ++i) {
newSong
songsList.at(i);
newSong. PrintSong();
E'Scanned with CamScanner
return 0;
-D-D-
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

Knowledge Booster
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.Similar questions
- Which data directive creates a 32-bit signed integer variable?arrow_forwardin cell b13, create a formula using the vlookup function that looks up the value from cell a11 in the range a5:b7, returns the value in column 2, and specifies an exact match. copy the formula to cell e13.arrow_forwardIs the following code for a wall mural a valid UPC number? If not, what should the check digit be in order to make this a valid UPC code> 0 88085 10811 4arrow_forward
- Second DFA needs to take any lowercase string and check if it contains your first name. The string can contain any number of characters before and after your name. As long as the string contains your first name it needs to be accepted.arrow_forwardClick cell C9 and insert a VLOOKUP function that looks up the code in cell B9, compares it to the codes and types of art in the range B2:C6, and returns the type of art. Copy the function in cell C9 to the range C9:C54. Hide column B that contains the codes.arrow_forwardThe updated code doesn't handle the arary with negative numbers. Can you help update the code to handle negative numbers?arrow_forward
- this is not correct. i am not suppose to use that header. stdio.h i am not suppose to use. everything is there in the question. please follow the guideline in the questionarrow_forwardIf the sequence number space is k-bit long, use Go-Back-N and selective-repeat. What's the sender window's maximum size?arrow_forwardQ3/Add the number (100110to 10101) by using 7482IC?arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education