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

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

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