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

  Implement a simplified version of the set class

You will implement a simplified version of the set class. You must implement all functions defined in the provided file set.h. You may add other member functions and variables as necessary.

  Write a program to calculate students average test scores

Write a program to calculate students average test scores

  Which of the following are valid case statements in a switch

What will following segment of code output? int x = 5; if (x != 2)      System,out.println( "This is true!"); else      System.out.println( "This is false!");      System.out.println("This is all folks!");

  Prompts the user to enter an integer

Write the code that prompts the user to enter an integer between 1 and 20 (including 1 and 20), reads the value using cin, and then prints the value that they entered in a statement that begins with "You entered a ". Save this version in a separate l..

  Write an lc-3 machine language program

Write an LC-3 machine language program starting at location x3000 which divides the number in memory location x4000 by the number in memory location x4001 and stores the quotient at x5000 and the remainder at x5001.

  Design a deck plan space ship in eclipse

Develop a simple interactive two-dimensional spaceship deck plan editor using OpenGL and GLUT. Your program will enable a user to create and save a deck plan of a hypothetical spaceship comprising the hull walls.

  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.

  Represent an instruction supported by simpletron

Implementation contains a Simpletron class and several supporting Instruction classes

  Create a text adventure game that uses pointers

Create a text adventure game that uses pointers. You have a rich, eccentric Uncle Billy who is soon to be deceased.

  Write a c function to convert gallons-quarts-pints and cups

Write a C function named liquid() that is to accept an integer number and the addresses of the variables gallons, quarts, pints, and cups.

  The fibonacci sequence

In the novel "The DaVinci Code", a scrambled version 13, 3, 2, 21, 1, 1, 8, 5 of the first eight Fibonacci numbers appear as one of the clues left by murdered museum curator Jacques Sauniere. In this assignment, we will do something related to t..

  The process function will then need

The process function will then need to find the time the person waited by calling the time function and finding the difference between the start and end timestamps. Save this time to an accumulator so that in the end you can find the average wait tim..

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