1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
babunello [35]
3 years ago
14

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; }; int main() { vector playlist; Song currentSong; string currentName; int currentDuration; unsigned int i; cin >> currentName; while (currentName != "quit") { /* Your code goes here */ } for (i = 0; i < playlist.size(); ++i) { currentSong = playlist.at(i); currentSong.PrintSong(); } return 0; }
Computers and Technology
1 answer:
lidiya [134]3 years ago
4 0

Answer:

kindly check explainations for code

Explanation:

Check below for program code.

#include <iostream>

#include <string>

#include <vector>

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<Song> 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 */

for(int i=0; i<albumSongs.size(); i++){

currSong = albumSongs.at(i);

if(currSong.GetDuration()<songDuration){

currSong.PrintSong();

}

}

}

int main()

{

Album musicAlbum;

string albumName;

getline(cin, albumName);

musicAlbum.SetName(albumName);

musicAlbum.InputSongs();

musicAlbum.PrintName();

musicAlbum.PrintSongsShorterThan(210);

return 0;

}

You might be interested in
What is the final gear reduction of a compound gear reduction of 36 to 12 for the first stage and 60 to 12 for the second stage?
OverLord2011 [107]

Answer:

8

Explanation:

Gear reduction = driven gear teeth / driving gear teeth

First stage reduction :

Driven gear teeth = 36

Driving gear teeth = 12

36 /12 = 3

Second stage reduction :

Driven gear teeth = 60

Driving gear teeth = 12

60 /12 = 5

First stage + second stage

3 + 5 = 8

5 0
3 years ago
You suspect a component in a computer is fried. You remove any unnecessary hardware devices one by one to narrow down where the
tankabanditka [31]

The examination phase

Further Explanation:

Hardware troubleshooting in computers requires a systematic and logical approach. Taking a logical approach helps you identify the root cause much easily. Ask yourself those questions first before getting to the bottom of anything. You will find it helpful to reproduce the problem and develop a hypothesis of the problem if you ask yourself those 20 questions.

Next comes the examination phase. Having gathered everything, I will now attempt a fix based on what I think I found. In my case, I suspect that there a component in my computer that is fried. A few ways to tell if my motherboard or components attached to the motherboard are fried is to remove the side panel first and examine the circuitry before removing any unnecessary hardware devices. Obvious sings will be smell of smoke. Examine the capacitors as well. Burnt capacitors have rounded tops. This is a clear indication that they are blown.

I will now remove every single component one by one from the motherboard and test my hardware on a low-level.

Learn more about computer hardware troubleshooting

brainly.com/question/12704715

brainly.com/question/13182488

#LearnWithBrainly

8 0
3 years ago
The concept of "plug and play" is demonstrated by which of the following<br> scenarios?
bagirrra123 [75]

Answer:

Farah has completed a post-secondary education program and is now ready to begin working, without additional training, on her first day .

Explanation:  HoPe ThIs HeLpS

6 0
3 years ago
What is a computer network that provides connectivity in a geographic area or region larger than that covered by a local area ne
lina2011 [118]

Answer:

The correct answer for the given question is "Metropolitan Area Network"

Explanation:

The metropolitan area network connect the user with a geographic area of the size of  metropolitan area.Metropolitan area network connect LAN i.e " local area network " to a single larger network thats provide efficient  connection to the WAN network.Their are many advantage to use metropolitan area network which are mention above .

  • Provides the better security then other network.
  • Cheaper lost when we connect MAN with WAN.
  • If we use MAN network then data will be fastly transferred.
6 0
3 years ago
(The Person, Student, Employee, Faculty, and Staff classes) Design a class named Person and its two subclasses named Student and
Mariulka [41]

Answer:

Explanation:

The following code is written in Java and creates all the classes as requested with their variables, and methods. Each extending to the Person class if needed. Due to technical difficulties I have attached the code as a txt file below, as well as a picture with the test output of calling the Staff class.

3 0
3 years ago
Other questions:
  • A. True
    8·2 answers
  • The data I collect in Google Forms are all compiled in a spreadsheet for me.<br> False <br> True
    12·2 answers
  • In an oligopolistic market, consumer choice is?
    12·2 answers
  • What's is the contribution of technology to the country?
    15·1 answer
  • On laptops with a smart card reader installed, where is the smart card reader usually located?
    13·1 answer
  • Which best describes a difference between transcription and DNA replication
    8·2 answers
  • Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the bool variabl
    6·1 answer
  • What is the best kernel synchronization solution on multicore systems when a lock is held for brief periods ?
    14·1 answer
  • By convention only, either the first usable address or the last usable address in a network is assigned to the router (gateway)
    11·1 answer
  • Jonas is creating a presentation for students about volunteering. He wants to begin by speaking about the various opportunities
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!