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;
};

Answers

Answer 1

Answer:

Here is the function PrintSongsShorterThan() which prints all the songs from the album shorter than the value of the parameter songDuration.  

void Album::PrintSongsShorterThan(int songDuration) const {  //function that takes the songDuration as parameter  

unsigned int i;  

Song currSong;  

cout << "Songs shorter than " << songDuration << " seconds:" << endl;  

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

currSong = albumSongs.at(i);    

if(currSong.GetDuration()<songDuration){    //checks if the song duration of the song from album is less than the value of songDuration  

currSong.PrintSong();     } } } //calls PrintSong method to print all the songs with less than the songDuration  

Explanation:

Lets say the songDuration is 210

I will explain the working of the for loop in the above function.

The loop has a variable i that is initialized to 0. The loop continues to execute until the value of i exceeds the albumSongs vector size. The albumSongs is a Song type vector and vector works just like a dynamic array to store sequences.  

At each iteration the for loop checks if the value of i is less than the size of albumSongs. If it is true then the statement inside the loop body execute. The at() is a vector function that is used to return a reference to the element at i-th position in the albumSongs.  

So the album song at the i-th index of albumSongs is assigned to the currSong. This currSong works as an instance. Next the if condition checks if that album song's duration is less than the specified value of songDuration. Here the method GetDuration() is used to return the value of duration of the song. If this condition evaluates to true then the printSong method is called using currSong object. The printSong() method has a statement cout << name << " - " << duration << endl; which prints/displays the name of the song with its duration.

The musicAlbum is the Album object to access the PrintSongsShorterThan(210) The value passed to this method is 210 which means this is the value of the songDuration.  

As we know that the parameter of PrintSongsShorterThan method is songDuration. So the duration of each song in albumSongs vector is checked by this function and if the song duration is less than 210 then the name of the song along with its duration is displayed on the output screen.  

For example if the album name is Anonymous and the songs name along with their duration are:  

ABC 400  

XYZ 123  

CDE 300    

GHI 200

KLM 100  

Then the above program displays the following output when the user types "quit" after entering the above information.  

Anonymous                                                  

Songs shorter than 210 seconds:                                                                         XYZ - 123                                                                                                              

GHI - 200                                                                                                              

KLM - 100  

Notice that the song name ABC and CDE are not displayed because they exceed the songDuration i.e. 210.


Related Questions

"the time it takes a storage device to locate stored data and make it available for processing is called"

Answers

Answer:

The time is called "Access time"

Explanation:

Basically it is the time taken to retrieve information/data

What is access time?

It is the time taken by a storage device to located information and process the information often times the access time is faster in hard drives when compared to other drives like Optical drives.

Another good analogy or description of access time is the time taken to order a product online and when it is delivered to you in your house

 

what keyboard command that will allow you to copy text

Answers

Answer:

Control + c

Explanation:

If you click and drag over text to highlight it and press on the control or command key (CTRL) and the "C" key, it will copy the text. When you want to paste it, you press control or command key (CRTL) and key "V" at the same time.

Which advantage of database processing makes it easier to make a change in the database structure?

Answers

Answer:

I HOPE IT WORK

Explanation:

An advantage of using the database approach to processing is that it facilitates consistency. True. Users never interact with a database, directly; database interaction is always through the DBMS

Which of the following terms means that the system changes based on
the needs of each learner?
A
Adaptive
B
Mobile-ready
С
Gamified
D
Reactive

Answers

Answer:

A

Explanation:

The following are types of numbers except one. Select the one which is not an integer.
A. Float
B. Int
C. Long
D. Boolean

Answers

Answer:

D) Boolean

Explanation:

Int, Float, Long and Boolean are commonly used data types in programming languages. Of these data types, the Boolean data type, named after George Boole, does not represent a numerical value. Rather it has one of two possible values, True and False. These values represent the two truth values of logic and Boolean algebra.

The Boolean data type is basically associated with conditional statements which specifies different actions to be taken depending on whether the Boolean condition evaluates to true or false. Therefore it influences the control flow of a program.

Select the components of a search engine.
a. robot
b. database
c. search form
d. all of the above

Answers

Answer:

C because whatever a search engine is it will need a search form to do its job, so C (maybe d)

A . There is a boy that traffics around the web and sorts out the result you see on your search engine e.g Google based on the input of the user that is what the user searched for
B. There would be obviously a database where all the results come from

Which of the following are characteristics of algorithms? Choose all that apply. They take a step-by-step approach to performing a task. They’re made up of Instructions posted on a website. They break the task into manageable steps. They identify the tasks that will repeat. They can be written in a computer language to create a program for a computer to follow.


Answer: They take a step-by-step approach to performing a task.
They break the task into manageable steps.
They identify the tasks that will repeat.
They can be written in a computer language to create a program for a computer to follow.

Answers

Answer:

They take a step-by-step approach to performing a task.

They break the task into manageable steps.

They identify the tasks that will repeat.

They can be written in a computer language to create a program for a computer to follow.

Explanation:

An algorithm is a step by step process that needs to be followed in order to solve logical, mathematical, well-defined instructions.

An everyday example of an algorithm is a recipe because it gives you steps to do in order to complete a task.

In computing terms, algorithms can be represented with flow charts, pseudocodes, or high-level languages.

Some of its characteristics include:

They can be written in a computer language to create a program for a computer to follow.They identify the tasks that will repeat. They take a step-by-step approach to performing a task. They break the task into manageable steps.

Answer:

So your answer will be

A.

C.

D.

E.

Explanation:

Edge2021

Where can you submit a bug report?​

Answers

Answer:

most developers incorporate a report a bug feature, if you cannot find it search online or go to the website on the software.

Explanation:

What is the output from the following code? MapInterface m; m = new ArrayListMap(); m.put('D', "dog"); m.put('P', "pig"); m.put('C', "cat"); m.put('P', "pet"); System.out.println(m.get('D')); System.out.println(m.get('E')); System.out.println(m.get('P'));

Answers

Answer: dog

null

pet

Explanation:

taking into condiserations the various animals and their tag given to them;

OUTPUT :

dog

null

pet

PROOF:

Where the Initially map : {}

after map.put('D', "dog"), map : {'D':"dog"}

after map.put('P', "pig"), map : {'D':"dog", 'P':"pig"}

after map.put('C', "cat"), map : {'D':"dog", 'P':"pig", 'C':"cat"}

after map.put('P', "pet"), map : {'D':"dog", 'P':"pet", 'C':"cat"}, what this does is replace the  value of P with "pet"

map.get('D') prints dog.

map.get('E') prints null, key is not present

map.get('P') prints pet

cheers I hope this helped !!

"The ______ of an operational system that supports an organization includes policies, requirements, and conditional statements that govern how the system works."

Answers

Answer:

decision logic

Explanation:. The decision logic of an operational system that supports an organization includes policies, requirements, and conditional statements that govern how the system works. These systems includes the following :

a) Order processing,

b)Pricing

c) Inventory control, and

d) Customer relationship management. And the traditional means of modifying the decision logic of information systems involves heavy interaction between business users and information technology (IT) analysts.

Outline a scenario in which you might be acting ethically but might still want to remain anonymous while using the Internet. How might someone learn your identity even if you attempt to remain anonymous?

Answers

Answer:

I would like to stay anonymous while criticizing the current government. As there have been many cases when people who wrote against the government's decisions were caught by the police.

So I would prefer to stay anonymous while commenting on various government policies. My friends would know about it because I share my posts only with them.

The government can know about my identity by ordering the social networking site to reveal it.

One scenario in which you can act ethically but still remain anonymous when using the internet could be to guarantee your freedom of expression on a certain subject, sharing your ideas in the way you think is ideal for the situation.

Is anonymity on the internet legal?

It is protected by the US Supreme Court under the First Amendment, but its protection is balanced, that is, anonymity on the internet can be dissolved and the user can be found if the use of this function occurs to commit cyber crimes.

Therefore, it is essential that every individual action on the internet and outside of it is based on ethics and legality, so that there is an orderly and positive society for all citizens.

Find out more information about cyber crimes here:

https://brainly.com/question/25157310

Which button is used to decrease the contrast for a selected image ?

Answers

Answer:

tab button........... ..

In GamePoints' constructor, assign teamWhales with 500 and teamLions with 500. #include using namespace std; class GamePoints { public: GamePoints(); void Start() const; private: int teamDolphins; int teamLions; }; GamePoints::GamePoints() : /* Your code goes here */ { } void GamePoints::Start() const { cout << "Game started: Dolphins " << teamDolphins << " - " << teamLions << " Lions" << endl; } int main() { GamePoints myGame; myGame.Start(); return 0; }

Answers

Answer:

Here is the GamePoints constructor:

GamePoints::GamePoints() :

/* Your code goes here */

{

teamLions = 500;

teamDolphins = 500;

}    

Explanation:

Here is the complete program:

#include  //to use input output functions

using namespace std; //to identify objects like cin cout

class GamePoints {  //class GamePoints

   public: GamePoints(); // constructor of GamePoints class

   void Start() const;  //method of GamePoints class

   private: //declare data members of GamePoints class

   int teamDolphins; // integer type private member variable of GamePoints

   int teamLions; }; // integer type private member variable of GamePoints

   GamePoints::GamePoints()  //constructor

    { teamLions = (500), teamDolphins= (500); }   //assigns 500 to the data members of teamLions  and teamDolphins of GamePoints class

   void GamePoints::Start() const    { //method Start of classs GamePoints

       cout << "Game started: Dolphins " << teamDolphins << " - " << teamLions << " Lions" << endl; }  //displays the values of teamDolphins and teamLions i.e. 500 assigned by the constructor

       int main() //start of main() function

       { GamePoints myGame;  // creates an object of GamePoints class

       myGame.Start(); //calls Start method of GamePoints class using the object

       return 0; }

The output of the program is:

Game started: Dolphins 500 - 500 Lions                    

Arrays save space because all elements of an array are stored in a single memory location while a list of variables needs a separate location for each variable.

a. True
b. False

Answers

Answer:

The correct option is A True

Explanation:

Arrays are implemented to store sevaral variables of the same type as a single array object in java for example. The arrays therefore acts as a container that can store several variables of the same type hence preventing the need to declare those variables seperately thus giving more code efficiency and better storage space management.

5.4.2: While loop: Print 1 to N. Write a while loop that prints from 1 to user_num, increasing by 1 each time. Sample output with input: 4 1 2 3 4

Answers

Answer:

import java.util.Scanner;

class Main {

 public static void main(String[] args) {

   Scanner in = new Scanner(System.in);

   System.out.println("Enter a number");

   int user_num = in.nextInt();

   int n = 1;

   while(n <= user_num){

     System.out.print(n+" ");

     n++;

   }

 }

}

Explanation:

Import Scanner to receive user numberCreate and initalize a new variable (n) to be printed outSet the while condition to while(n <= user_num)Print the value of n after each iteration and increment n by 1

Answer:

Written in Python:

i = 1

user_num = int(input()) # Assume positive

while i <= user_num:

   print(i)

   i += 1

Explanation:

Give a command that will create a file named listing.dat, in your current (commandsAsst) directory, containing a list of all the files in your fileAsst directory. I need to use redirection, and have tried almost every variation of ls -a < ~/UnixCourse/fileAsst. > listing.dat Primarlily the error I get is that I did not create the 'listing.dat file with ALL of the files located in ../fileAsst/ When I run the same command in another terminal window, then verify with ls -a I can see that I did indeed create the listing.dat file. Can someone tell me what it is I am missing?

Answers

Answer:

Following are the command to this question:

"ls -a ~/UnixCourse/fileAsst > listing.dat"

Explanation:

The above-given code will create a file, that is "listing.dat", and this file will be created in your current directory, which will include the list of all files in the file-asst directory.

In this, Is command is used that uses the directory that is "UnixCourse/fileAsst" and inside this, it will create the "dat" file that is "listing".

Given two strings s and t of equal length, the Hamming distance between s and t, denoted dH(s,t), is the number of corresponding symbols that differ in s and t.
Given: Two DNA strings s and t of equal length (not exceeding 1 kbp).
Return: The Hamming distance dH(s,t).
Sample Dataset
GAGCCTACTAACGGGAT CATCGTAATGACGGCCT
Sample Output
7

Answers

Answer:

computer and technologycomputer and technology

Explanation:

computer and technologycomputer and technology

Which security scanner runs in a web browser and doesn't require that you install a product before scanning

Answers

Answer:

It’s OSI. also your question cut off lol

Should behavioral tracking be legal? Why or why not?

Answers

Answer:

I honestly don't see very many reasons on why it is bad because it's just showing you ads that you might actually want to see instead of some random ad about cats whenever you own a goldfish, but I feel like websites should ask for permission before they do it.

Answer:

     Behavioral Tracking should be legal. I don't see very many reasons as too why behavioral tracking is bad being shown as ads that might actually be useful, but websites should ask for permission before they do it.

Which of the following code segments will display all of the lines in the file object named infile, assuming that it has successfully been opened for reading?
a. while line in infile :
print(line)
b. while infile in line :
print(line)
c.for infile in line :
print(line)
d. for line in infile :
print(line)

Answers

Answer:

d.

for line in infile :

   print(line)

Explanation:

for loop is used to iterate through the each line of the file using line variable. The file is accessed using the object infile. For example if the file name is "file.txt" and it is opened in read mode. It contains the following lines:

hi there friend

how are you

what are you doing

Then the above given chunk of code gives the following output

hi there friend

how are you

what are you doing

At each iteration each line of the the file is printed on the output screen. The print() method is used to display these lines in output.

If you’re storing some personal information like Debit/Credit card numbers or Passwords etc, on different sites for running you’re E-business. Do you think that cookies are stored and maintain such information on the server-side and hackers can''t steal user''s information from these cookies easily? Do you agree with the above statement? Please give short comments in favor of or against the statement.

Answers

Answer:

No, hackers can steal information from cookies. This many times depend on the type of cookies.

Cookies, by general definition, are programs embedded onto browsers which collect non-invasive information about our activities such so that it can adapt to our needs.

The type of information that a cookie collects depends on what type of cookie it is.

Session Cookies: These types of cookies only collect information about the movement of the user on the website such as pages visited, products that were examined (for e-commerce websites) and products/services that the user put in their cart.

These type of cookies are temporary and are deleted as soon as the browser is shut down.

Persistent Cookies:

These do the same thing that the Session cookies do only that they are more permanent and are stored in a text file even after the browser and the computer has been shut down.

It is these types of cookies that pose a threat. These type of cookies many store codes and passwords and log-in details which may be exploited by a hacker.

Cheers!

kyra needs help deciding which colors she should use on her web page. what can she use to help her decide?​

Answers

Answer:

What colors does she like most, and what colors best correlate with the subject of the website.

Explanation:

You want to have the color relate to the subject of the website, or just favorites!

Answer:

Storyboarding.

Write a program that reads a person's first and last names separated by a space, assuming the first and last names are both single words. Then the program outputs last name, comma, first name. End with newline. Example output if the input is: Maya Jones

Answers

Complete Question:

Write a program that reads a person's first and last names, separated by a space. Then the program outputs last name, comma, first name. End with newline.  

Example output if the input is: Maya Jones

Jones, Maya

In C++

Answer:

The program written in C++ is as follows

#include<iostream>

using namespace std;

int main(){

string lname, fname;

cout<<"First name: ";

cin>>fname;

cout<<"Last name: ";

cin>>lname;

cout<<lname<<", "<<fname;

return 0;

}

Explanation:

This line declares lname, fname as string to get the user's last name and first name, respectively

string lname, fname;

This line prompts the user for first name

cout<<"First name: ";

This line gets the user first name

cin>>fname;

This line prompts the user for last name

cout<<"Last name: ";

This line gets the user last name

cin>>lname;

This line prints the desired output

cout<<lname<<", "<<fname;

The program in Python is

person_name = input("Enter your first name and last name separated

                           by space: ")

split_names = person_name.split( )

first_name = split_names[0]

last_name = split_names[1]

print(last_name + ", " + first_name)

The first line of the program requests the first and last names as a single string, separated by a space.

The next line splits the name into first and last names

Finally, the print statement displays the names reversed, but separated with a comma

See another example of a Python program here: https://brainly.com/question/21861447

Assume the following Python code has already executed.
import os
cwd = os.getcwd()
Which answer is most likely output from the following Python statement?
os.path.join(cwd, 'Documents/file.txt')
Select one:
a. ['Music', 'Pictures', 'Desktop', 'Library', 'Documents', 'Downloads']
b. False
c. True
d. /Users/me
e. /Users/me/Documents/file.txt

Answers

e. /Users/me/Documents/file.txt

The Python statement is an illustration of file manipulations

The output from the Python statement is: (e) /Users/me/Documents/file.txt

From the given statement, the first line imports the Python os module.

While the second line gets the current working file path.

So, the statement os.path.join(cwd, 'Documents/file.txt') means that:

The current working file path is Documents/file.txt

Hence, the output from the Python statement is: (e) /Users/me/Documents/file.txt

Read more about file manipulations at:

https://brainly.com/question/19386916

Which statement correctly creates a set named colors that contains the 7 colors in a rainbow?
a. colors = ["red", "orange", "yellow" "green", "blue", "indigo", "violet"]
b. colors = {red, orange, yellow, green, blue, indigo, violet}
c. colors = [red, orange, yellow, green, blue, indigo, violet]
d. colors = {"red", "orange", "yellow", "green", "blue", "indigo", "violet"}

Answers

Answer:  d. colors = {"red", "orange", "yellow", "green", "blue", "indigo", "violet"}

Explanation:

We use "{}" to write a set in it.

Also, the names of the colors are strings so we use inverted commas ("") to express them.

So, the set named colors that contains the 7 colors in a rainbow will be:

colors = {"red", "orange", "yellow", "green", "blue", "indigo", "violet"}

Hence, the correct option is d.

Home communication involves controlling systems such as heating, cooling, and security.
a. True
b. False

Answers

Answer:

A. True

Explanation:

Home communications involves automating home. It includes controlling the air-con,water heater, webcam, etc. A

When enabling IPsec mobile client support, you made some selections in the Xauth section of the interface. What does Xauth stand for

Answers

Answer:

Extended authentication

Explanation:

Xauth = Extended authentication

An extended authentication can cause security to be increased because it requires the user to enter a username and password. These details would then be authenticated at the internal database of the controller. This extension is an ipsec extension which would enable VPN users to enter a username and password. These details would be required of the user while trying to connect and they would be checked against the login details registered by such a user.

Would two bits be enough to assign a unique binary number to each vowel in the English language? Explain.

Answers

Answer:

No.

Explanation:

Since there are 5 vowels, you'd need at least 3 bits to number them. 2 bits give you 2²=4 possibilities, which is 1 short. 3 bits give you 2³=8 possibilities, which fits 5 easily.

The term "bit" means binary digit, and it is used to represent data in a computer system.  

The number of character an n-bit computer can hold is [tex]2^n[/tex]

So, a 2-bit computer can hold a maximum of:

[tex]Max = 2^2[/tex]

[tex]Max = 4[/tex]

i.e. A 2-bit computer can hold a maximum of 4 characters.

The English language vowel are 5 (i.e. letters a, e, i, o and u).

5 is greater than the maximum number of characters the 2-bit computer can hold (i.e. 5 > 4)

Hence, two bits will not be enough to hold each vowel in the English language.

Read more about binary digits at:

brainly.com/question/9480337

You are entering command that operates on a file. The path to the file is lengthy and confusing and you are afraid that you will misspell part of it. You can help yourself out via the use of:________

Answers

Complete Question:

You are entering command that operates on a file. The path to the file is lengthy and confusing and you are afraid that you will misspell part of it. You can help yourself out via the use of?

Group of answer choices

A. Wildcard

B. The Tab key

C. Regular expressions

D. The Escape key

Answer:

B. The Tab key

Explanation:

In this scenario, You are entering command that operates on a file. The path to the file is lengthy and confusing and you are afraid that you will misspell part of it. You can help yourself out via the use of the Tab key.

When working with the command line prompt (cmd) on a Windows, Unix or Linux computer, typing file paths is sometimes difficult or considered to be a burden because they are lengthy (too long) and perhaps confusing to the user. To help yourself out, you can always use the "Tab key" to autocomplete names of directories or file paths in an alphabetical order, while in the command line.

Additionally, pressing the "Tab key" continuously while in the command line would cycle or toggle all available commands in an alphabetical order.

What are the advantages and disadvantages of solving a problem that can be broken down into repetitive tasks with recursion as opposed to a loop? Explain your answer.

Answers

Answer:

Answered below

Explanation:

Recursion refers to the process of a function calling itself within its own definition. It calls itself repeatedly until a base condition is met and the loop breaks.

The advantages of recursion over loops include;

A) Recursion reduces time complexity.

B) Recursion is better at tree traversal and graphs.

C) Recursion reduces the time needed to write and debug code and also adds clarity to code.

Disadvantages of recursion include;

A) Recursion uses more memory because each function call remains in stack until the base case is met.

B) Recursion can be slow.

C) Recursion

Other Questions
A newspaper article about the sinking of the Titanic from 1912 is a ______________ source. Find the number that completes each of the following proportions: a.8120=4c b.n0.5=0.71 c.8x=23 d. 7:6=k:120 The time intervals between successive barges passing a certain point on a busy waterway have an exponential distribution with mean 8 minutes. (a) Find the probability that the time interval between two successive barges is less than 5 minutes. (b) Find a time interval t such that we can be 95% sure that the time interval between two successive barges will be greater than t. A regular hexagon has vertices at the coordinates listed below. Find the perimeter of the hexagon(-12, -8).(-12, 7), (0, 16), (12,7), (12, -8), (0, -17)789990114 House of quality is a part of the quality function deployment process that utilizes a planning matrix to relate customer "wants" to "how" the firm is going to meet those "wants" Pursuant to the Constitution, the President is the commander in chief of the Army and Navy of the United States, and of the militia of the several states, when called into the actual service of the United States.a. Trueb. False Look at the image.Point F, point B, and point C are linears.|AD|= |FB|= |BC| , [FD] is a perpendicular of [AC] .Angle DFC= 12find the value of angle BAC= x (with detail please) Se vendieron para una funcin en el teatro 255 entradas a $130,antes del comienzo de la funcin,hubo 5 devoluciones,pero luego se vendieron dos entradas mscuantas personas asistieron a la funcin?cuanto dinero se recaud? I need help asap plssss To prepare for a trial between Condo Development Corporation and Demo Construction Company, Condo's attorney places Demo's president under oath. An authorized court official makes a record of the attorney's questions and the officer's answers. This is Prove the multiple of two consecutive integers is positive factorizeab(ab-bc)+bc(bc-ab) 81x^7/9x^3 a. 9x^10 b. 9x c. 9x^4 d. 81x^7 9 A plant's fixed overhead costs total $500,000 for a year to produce 400,000 widgets, among other items. If machinehours are used as an allocation base, all processes use a total of 40,000 machinehours, and widgets use 16,000 of these hours, what is the fixed overhead applied to each widget? Group of answer choices In which career would you most likely apply concepts from geometry? A. food critic B. social worker C. radio DJ D. computer game designer The width and the length of a rectangle are consecutive even integers. If the width is decreased by 3 inches, then the area of the resulting rectangle is 24 square inches. What is the area of the original rectangle Give the definition of c identifier can any correct my mistakes 3 5/6 as a mixed number describe how to obtain the graph of the transformed function below from its parent function.