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 is NOT something that a game producer needs to do?
3241004551 [841]

Answer:

Plan the script, characters, and how the game is played

6 0
3 years ago
Pls help I will give points
Fed [463]

Answer:

phone !!

Explanation:

since it's a mobile app, that would apply to a handheld device !!

i hope this helps !!

3 0
3 years ago
Read 2 more answers
What are the pros and cons of MP3 audio archives?
UkoKoshka [18]
Was this in reference to literal audio archives? If so, I don't see any cons beside possible copyright infringement.

If you're talking about the codecs themselves, then I can do that.

<span>Pros:

</span>- Widespread acceptance. Supported in nearly all hardware devices, and continually adopted by newer ones.

- Faster decoding. Much more so than FLAC, Vorbis, etc.

- Relaxed licensing schedule.

<span>Cons:
</span><span>
</span>- Lower quality and efficiency than most modern codecs. (To be fair, never really noticed this one).

- Sometimes the maximum bitrate isn't enough.

- Pretty much void/unusable for high definition audio (higher than <span>48kHz).</span>

 
7 0
3 years ago
2. Create a file with the follow integer/string content and save it as fun.txt. 6 fun. 3 hello 10 &lt;&gt; 2 25 4 wow! Write an
Nesterboy [21]

Answer:

see explaination

Explanation:

I made use of python program to solve this.

text file name with fun.txt.

6 fun. 3 hello 10 <> 2 25 4 wow!

Program code:

import re

file = open('fun.txt','r') #for reading file

strings="" #declaring empty string

for k in file:

strings=strings+k #all character in file is storing in strings variable for do operations

pattern = '\s' #for pattern \s is for space

result = re.split(pattern, strings) #split the string with space

for k in range(len(result)): #loop through the list of string

if(k%2) == 0: #checking for integer to time of string

p=int(result[k])

print(result[k+1] *p) #print times of the string(k+1)

Check attachment for output

8 0
3 years ago
Mail merge requires an MS Word document in order to work.<br><br> True<br> False
Kipish [7]

True is correct. Hope it helps


3 0
3 years ago
Read 2 more answers
Other questions:
  • Assume that success is a variable of type boolean that has been declared. Assume that processor refers to an object that provide
    6·1 answer
  • The isometric projection camera technique provides an illusion of perspective by using things like parallax scrolling to create
    10·1 answer
  • Which building-block feature is available in the Text grouping on the Insert tab?
    14·1 answer
  • Your organization's network has multiple layers of security devices. When you attempt to connect to a service on the Internet. H
    9·1 answer
  • What type of software is responsible for managing processor time and memory allocation?
    7·1 answer
  • Which of the following is best known as a business network LinkedIn, Facebook, Twitter or Word Press?
    15·1 answer
  • A _______________ is a particular type of network that uses circuits that run over the Internet but that appears to the user to
    10·1 answer
  • Every time a key is pressed on the keyboard, the _______________ chip in the keyboard notices which key has been pressed.
    13·1 answer
  • The field of ____ is concerned with the technical issues involved in information display. computer science
    14·1 answer
  • Which part of the ethernet address is assigned to vendors to identify the equipment?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!