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
The geographic coordinate system is used to represent any location on Earth as a combination of latitude and longitude values. T
Pachacha [2.7K]

Answer:

Here is the script:  

function dd = functionDMS(dd)  

prompt= 'Enter angle in DD form ';

dd = input(prompt)

while (~checknum(dd))

if ~checknum(dd)

error('Enter valid input ');

end

dd = input(prompt)

end  

degrees = int(dd)

minutes = int(dd - degrees)

seconds = ( dd - degrees - minutes / 60 ) * 3600  

print degrees

print minutes

print seconds

print dd

Explanation:

The script prompts the user to enter an angle in decimal degree (DD) form. Next it stores that input in dd. The while loop condition checks that input is in valid form. If the input is not valid then it displays the message: Enter valid input. If the input is valid then the program converts the input dd into degrees, minutes and seconds form. In order to compute degrees the whole number part of input value dd is used. In order to compute the minutes, the value of degrees is subtracted from value of dd. The other way is to multiply remaining decimal by 60 and then use whole number part of the answer as minutes. In order to compute seconds subtract dd , degrees and minutes values and divide the answer by 60 and multiply the entire result with 3600. At the end the values of degrees minutes and seconds are printed. In MATLAB there is also a function used to convert decimal degrees to degrees minutes and seconds representation. This function is degrees2dms.

Another method to convert dd into dms is:

data = "Enter value of dd"

dd = input(data)

degrees = fix(dd);

minutes = dd - degrees;

seconds = (dd-degrees-minutes/60) *3600;

8 0
3 years ago
Ana is a music lover. She loves to download songs and videos on her computer every time she hears a new song. One day, her compu
o-na [289]

Answer:

Storage outage

As many new songs are released to the Internet every day, Anna might have download thousands of them, which made her computer ran out of storage and RAM(random access memory )

5 0
2 years ago
Describing light years
kogti [31]

Answer:

For most space objects, we use light-years to describe their distance. A light-year is the distance light travels in one Earth year. One light-year is about 6 trillion miles (9 trillion km). That is a 6 with 12 zeros behind it!

5 0
3 years ago
A malicious user in your organization was able to use the Trinity Rescue Kit to change the password on a department manager's co
netineya [11]

Answer:

The answer is "The PC should be kept in a physically secure location".

Explanation:

In general, malicious users are hackers as well as malicious users. This user indicates that even a rogue worker, contractor, student, and another consumer who uses his sensitive rights is indeed a common word of violation of information in security circles and the headlines, and to manage the data from the theft the system should be on the physically secure location, that refers to any place, a room or a group of room within facilities of physical or staff security protocols that are sufficient to support the AI-based on LEIN and related Is a physically safe room.

7 0
2 years ago
Características que debe tener un módulo o kit tecnológico para aprender​
12345 [234]

Answer:

Multi herramientas

Explanation:

Un kit tecnologico debe contener todas las herramientas necesarias para el trabajo que lo necesites, por ejemplo destornillador magnetico con varias puntas, herramientas para desmontar y por supuesto tener buena claridad para trabajar y alcohol isoprofilico de al menos 90+ para limpiar electronicos.

5 0
2 years ago
Other questions:
  • Yahoo! allows users to create personalized my yahoo! pages. users can add or delete a variety of information from their personal
    8·2 answers
  • When you make taffy (a pliable candy), you must heat the candy mixture to 270 degrees Fahrenheit. Write a program that will help
    6·1 answer
  • A personal career profile for can be used to match what you know about yourself to what you know about different careers
    7·2 answers
  • 1. Describe a linear search (explain how it works).
    13·1 answer
  • What font option will elevate part of the text to a higher level and decrease its size? A. Subscript
    8·1 answer
  • Knowing what you know about today’s video games, imagine what it would look like if you had to create a modern-day version of Sp
    6·1 answer
  • A user calls your help desk to report that the files on her USB stick do not have any permissions associated with them and there
    15·2 answers
  • Implement a Python function with the signature Transfer(S, T) that transfers all elements from the ArrayStack instance S onto th
    13·1 answer
  • Write a program to check the password( qbasic)​
    8·1 answer
  • Implement one array of the English alphabet (26 characters). a) Create a function, getLetters() to cast and generate the array.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!