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
Pls help :( I am a radio and audio production student. What are two examples of a complex wave?
Brilliant_brown [7]

Answer:

A complex wave is a wave made up of a series of sine waves; it is therefore more complex than a single pure sine wave. This series of sine waves always contains a wave called the "FUNDAMENTAL", that has the same FREQUENCY (repetition rate) as the COMPLEX WAVE being created.

Examples for complex wave:

<em>• The Square wave </em>

<em>• The Triangular wave </em>

<em>• The Saw-tooth wave</em>

<em />

<em>Hope you got it </em>

<em> If you have any question just ask me </em>

<em>If you think this is the best answer please mark me as brainliest</em>

4 0
3 years ago
Advantages and disadvantages of internet
Papessa [141]
Advantages of Internet:
1. Easy and fast access to information2. Up to date news information3. Communications made over internet connecting people around the world4. Convenience in doing like research where you can now do it at home instead of visiting libraries.
Disadvantages of Internet:
1. Possible theft of personal information2. Internet addiction which leads to social isolation3. Inappropriate Contents 
7 0
3 years ago
Read 2 more answers
Now you are ready to implement a spell checker by using or quadratic. Given a document, your program should output all of the co
Harlamova29_29 [7]

Answer:

Sorry po idont know po ehhh sorry

5 0
3 years ago
Ill give 100 points to whoever gives me the CORRECT answer. I keep getting syntax errors when I do the "add:" part. Can someone
Olin [163]

Answer:

sorry but there is not enough information to complete this

Explanation:

6 0
2 years ago
Read 2 more answers
Points!!!!!!!! pls help
siniylev [52]
D. Rasterize

This answer makes the most since
7 0
3 years ago
Read 2 more answers
Other questions:
  • What Event is called when an Object collides with an non-trigger collider?
    13·1 answer
  • Individuals with desirable traits will be __________ to have young that survive than individuals without these traits. (2 points
    5·2 answers
  • You are adding new wires in your building for some new offices. The building has a false ceiling that holds the lights and provi
    8·1 answer
  • To create a cover letter to send to potential employers along with a resume, what software program should you use ?
    6·2 answers
  • Enables businesses and consumers to share data or use software applications directly from a remote server over the Internet or w
    6·1 answer
  • What is the base for a hexadecimal number system?
    11·1 answer
  • What are 3 important reasons to reconcile bank and credit card accounts at set dates?
    15·1 answer
  • TRUE AND FALSE
    10·1 answer
  • How do you do 3.4.5 Add parentheses for code hs? I need answers please
    15·2 answers
  • You must configure a certificate authority on your network to use EFS. True or False?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!