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
Which of the following is the most appropriate wireless technology for real-time location of caregivers and mobile equipment in
Gekata [30.6K]
Wi-Fi is the anwser.Hope I helped.
7 0
2 years ago
Can anyone give me nitrotype gold? Name username is lol3628 display name is iluvkitkats
Vsevolod [243]

Answer:

no

Explanation:

3 0
3 years ago
Read 2 more answers
Explain the RISC and CISC architecture. Comparison of RISC and CISC in detail.
puteri [66]

Answer:RISC(reduced instruction set computer) is the computer used for low level operation by simple command splited into numerous instructions in single clock only and CISC(Complex instruction set computer) is the computer that performs the operation in single instruction.

RISC architecture has hardwired control unit,data cache unit,data path ,instruction cache and main memory as components .CISC architecture persist of  control unit,micro program control memory, cache, instruction and data path and main memory.

The differences between RISC and CISC are as follows:-

  • The instruction in RISC are less and and low complexes while CISC has several number of complex instruction.
  • The calculation done by RISC are precise and quick whereas CISC has slightly slow calculation processing.
  • The execution of RISC is faster as compared to CISC.
  • RISC uses hardware component for implementation of instruction because it does not persist its own memory and CISC implements instructions using its own memory unit .

6 0
3 years ago
Can folders have mixed apps?
sweet-ann [11.9K]

Answer:

what

Explanation:

8 0
2 years ago
A Software Developer wants to add a new feature to an existing application operating in the Cloud, but only wants to pay for the
Mamont248 [21]

A term which describes this feature of cloud computing is: C. serverless computing.

<h3>The features of cloud computing.</h3>

In Computer technology, the features of cloud computing include the following:

  • Elasticity
  • Pooled resources
  • On-Demand self-service
  • Multitenancy
  • Serverless computing

In Cloud computing, serverless computing is a feature that is typically used to add a new feature to an existing software application that is operating in the Cloud while having to pay only for the computing time which the software code actually uses when it is called.

Read more on cloud computing here: brainly.com/question/19057393

#SPJ1

8 0
2 years ago
Read 2 more answers
Other questions:
  • Instructions
    12·1 answer
  • After adding an email account, how do you switch accounts to send a message?
    10·2 answers
  • Package Newton’s method for approximating square roots (Case Study: Approximating Square Roots) in a function named newton. This
    7·1 answer
  • Name three recent advances that are influencing OS design.
    15·1 answer
  • When you set up social connections, each generic icon in the contacts list and the People Pane will be replaced with the profile
    12·1 answer
  • What is human data,
    8·1 answer
  • How is communication within healthcare different than communication within other industries ?
    13·1 answer
  • What is sampling?
    6·1 answer
  • The system where the unit of measurement is centimeter
    15·1 answer
  • Why is it important not to leave your personal information on a public computer?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!