A linked list of your song structure in cd

Assignment Help C/C++ Programming
Reference no: EM13163590

The CD object should have a data member that is a linked list of your song structure that you have in CD. The CD class needs a function that allows it to add a song to the object, that function would then append the song to that instance of the linked list (the one with the structure). Then once all the songs are added then you append it to the CD list in main. There should not be a variable called songs that is global. You will need a copy constructor that will copy the songs in the list in the class, if not then it will not append the songs list when you append it to the list in main.

 

// This class uses a linked list to keep track of the

// titles of songs on a CD. It also maintains the

// length and title of each song.

class CD : public Media

{

private:

 

string artist; // To hold the artist name

 

public:

// Declare a struct

struct Song

{

string title;

double length;

}my_disc;

 

CD();

CD(string);

CD(string, string, double);

 

// Mutators

void setArtist(string);

 

// Accessors

string getArtist();

 

// Overloaded operators

bool operator == (const CD &e);

bool operator != (const CD &e);

 

};

#endif

#include "CD.h"

//*********************************************************

// Default constructor initalizes the data member. It also*

// calls the base constructor *

//*********************************************************

CD::CD() : Media()

{

artist = "";

}

 

//*********************************************************

// Default constructor sets the data member artist. It *

// also calls the base constructor and passes name and *

// length as arguments *

//*********************************************************

CD::CD(string a, string n, double l ) : Media(n, l)

{

artist = a;

}

 

//*********************************************************

// setArtist accepts a parameter as an argument and sets *

// the data member *

//*********************************************************

void CD::setArtist(string a)

{

artist = a;

}

 

//*********************************************************

// getArtist returns the artist *

//*********************************************************

string CD::getArtist()

{

return artist;

}

 

//*********************************************************

// Overloaded == operator compares the artist *

// with that of the parameter *

//*********************************************************

bool CD::operator == (const CD &e)

{

if (artist == e.artist)

return true;

return false;

}

 

//*********************************************************

// Overloaded != operator compares the artist *

// with that of the parameter *

//*********************************************************

bool CD::operator != (const CD &e)

{

if (artist != e.artist)

return true;

return false;

}

 

 

Reference no: EM13163590

Questions Cloud

Explain the increased epinephrine will increase : you are taking a walk when a bid mean dog growls and begins to chase you. The increased epinephrine will increase? a glycolysis in the liver b glycolysis in the muscle
State molarity is a common unit of concentration : Chemists often use molarity ,M in Moles/liter , to measure the concentration of solutions. Molarity is a common unit of concentration because the volume of a liquid is very easy to measure
State aldol reaction to form ethyl trans-cinnamate : Why isn't sodium hydroxide? In the reaction of Aldol reaction to form ethyl trans-cinnamate. Reactant are Benzaldehyde and ethyl acetate.
Explain the uncatalyzed decomposition of hydrogen peroxoide : the uncatalyzed decomposition of hydrogen peroxoide is first order with an activation energy of 75.3 kj/mol and a half life of 6 hrs at 40 degrees celcius.
A linked list of your song structure in cd : The CD object should have a data member that is a linked list of your song structure that you have in CD.  The CD class needs a function that allows it to add a song to the object, that function would then append the song to that instance of the link..
Explain volumetric flask and diluting to the mark : solution with a pipet to a second 500.0 mL volumetric flask and diluting to the mark. Find the concentration of Ag+ in the dilute solution.
State the heat of vaporization of liquid a : At 25 degrees Celsius liquid A has a vapor pressure of 100 torr while liquid B has a vapor pressure of 200 torr. The heat of vaporization of liquid A is 32 kJ/mol
Explain henderson-hasselbach equation : If someone can go in depth into finding the Ka to this and then guiding me through the rest of the steps, I'd be eternally grateful
Mips uses word alignment : MIPS uses word alignment, so all words are stored in memory on word boundaries; this means that address bits A[1:0] are always 00. How many and which address bits would be allocated for the set index?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write program to input series of hourly temperatures

Create and write a c++ program which inputs series of 24 hourly temperatures from file, and outputs bar chart (using stars) of temperatures for the day.

  Program to print out invalid number to character

The integer must contain 3 distinct non-zero number, or the program will print out invalid number.it should print out invalid query.

  Using opengl to create a cube

Write a program in C/C++ using OpenGL to create (without using built in function) a cube by implementing translation algorithm by translating along 1. X-axis, 2.Y-axis and 3. X and Y plane

  Write a bouncing ball video game

The balls bounces within the screen where the two horizontal walls are fixed

  Write a program to read a data file and extract parameters

Write a C/C++ program to read a data file and extract parameters. The program must obtain the filename via a command-line argument.

  Loops and if conditions

Write a program that requests a password

  Write a program to find that number for nguyen.

In some Asian countries, 8 and 6 are considered lucky digits. Any number containing only 8s and 6s is considered lucky number, e.g. 6, 8, 66, 668, 88, 886 .... Nguyen is a student who likes mathematics very much. Nguyen likes lucky numbers but only o..

  Create constructor function which takes no inputs

You must have the constructor function which takes no inputs and randomly generates the 5 letter string for name and random integers from 20 to 40 for both age and class size.

  Develop a two dimensional interactive game

The player starts as a disk, but can "morph" (that is expand and contract) in selected directions

  Write a program to find the middle element in a linked list

1. Write a program to check if there is a loop in a linked list. Create a loop in a linked list and use your method 'isLoop' to identify that the loop exists. The method isLoop should return a Boolean type.2.

  Write program in c to calculate diameter-compression load

Write a program in C to calculate diameter in centimeters of steel rod, an aluminum rod, and a copper rod, which can withstand a particular compression load.

  Takes 100 number in an array

Write a program in c++ that takes 100 number in an array and add them and print the sum

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd