Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This program will allow the user to keep track of both a CD and a DVD collection

ID: 662740 • Letter: T

Question

This program will allow the user to keep track of both a CD and a DVD collection. The program needs to work for both CDs and DVDs. There should be a base class that maintains the common information between a CD and a DVD. Each CD/DVD in the collection will be represented as a class, so you will have one class that will be a CD and another that will be a DVD. The program will then has a base class called Media. Both the CD and DVD classes will inherit from the same base class.

The base class will have one data member that will hold the CD Name or Movie Title and another data member for the length of the total CD or the length of the movie.

The CD class will use a linked list to keep track of the titles of the songs on the CD; this will allow each CD to have a different number of songs. It should also maintain the length of each song, thus the class will use a structure which will have the song title and its length. Each song will be an instance of this structure and will be stored in the linked list. The class will also have a data member for the artist name.

The DVD class will have data members for the year the movie was released. The class will have a linked list for storage of the name of the actors and actresses in the movie. The class will also maintain the character names that the actors/actresses played in the movie. The actors/ actresses and characters information will be stored in a structure which will be stored in the linked list.  

The program will then maintain two lists, one for the CDs and another for DVDs. The program will use linked lists to maintain the two different lists. The program must provide methods (functions) to add a CD/DVD, remove a CD/DVD and update a CD/DVD. There should also be a function that displays the entire list of CDs/DVDs. The output must be a table format, with heading.

NOTE: There must be only one linked list class (template) that will be used for each of the lists needed in this program. Derived classes of the linked list can be added to expend the functionality of the linked list to be specific for each class.

Movie Title         Length of Movie               Year Released             Actors/Actresses                   Characters

NOTE: The movie title, length of movie and year released should only appear once while the actors/actresses and characters will have several lines. So the other columns must be displayed with blanks.

Artist                     CD Name             Length of CD                      Song Title                            Song Length

NOTE: The artist name, CD name and length of CD should only appear once while the song title and length will have several lines. So the other columns must be displayed with blanks.

Explanation / Answer

#include "DVD.h"

#include <iostream>

#include <string>

#include <vector>

using namespace std;

class DVD    //Redefinition of 'DVD'

{

   

    private:

        string title;             //Holds title of dvd

        int year1;                 //Year1 made

        double len;            //Holds len of movie

   

   

    public:

        vector<string> actrs;     //Acts and Actresses

        vector<string> charNames; //Character names

   

   

    void set_Title(string);

    void set_Len(double);

  void set_Year1(int);

    void addAct_Char(string, string);

   

    string get_Title();

    double get_Len();

    int getYear1();

   

   

    DVD()                {

        title = "";

        year1 = 0;

        len = 0;

       

       

    }   

};

#ifndef __DVD_Database__DVD__

#define __DVD_Database__DVD__

#include <iostream>

#include "DVD.cpp"

#include <vector>

#include <string>

DVD DVD;

void DVD::set_Title(string t)

{

    title = t;

}

void DVD::set_Len(double l)

{

    len = l;

}

void DVD::set_Year1(int y)

{

    year1 = y;

}

void DVD::addAct_Char(string actrs, string charNames)

{

   

    act.push_back(actrs);       //Undeclared identifier 'act'

   

    charat_name.push_back(charNames); //Undeclared identifier 'charat_name'

   

   

    //pushback character

   

}

#endif /* defined(__DVD_Database__DVD__) */

#include "DVD.h"

#include "DVD.cpp"

#include <iostream>

#include <string>

#include <vector>

using namespace std;

int main()

{

    int sel;      //Used for menu system

    int num_Peep;        //Holds the number of people in the movie

    string title;       //Holds title of dvd

    int year1;           //Year1 made

    double len;     //Holds len of movie

    string act;       //Hold act/actress name/

    string charat_name;      //Holds character name

   

    class DVD DVD;      //DVD Object

   

   

   

   

   

   

    //Menu System

   

    cout << "*****************************************************************************************" << endl;

    cout << "*                                                                                       *" << endl;

    cout << "*                                     DVD Collection                                    *" << endl;

    cout << "*                                                                                       *" << endl;

    cout << "*****************************************************************************************" << endl;

    cout << endl;

    cout << endl;

    cout << "1. Add DVD" << endl;

    cout << "2. Remove DVD" << endl;

    cout << "3. Update DVD" << endl;

    cout << "4. Show DVDs" << endl;

    cin >> sel;

   

   

    switch (sel)

        {

           

            case 1:

            {

                cout << "To add a new DVD please enter the title, len, year1 release, acts and their characts" << endl;

                cout << endl;

                

                cout << "Movie Title: ";

                getline(cin, title);

                cout << endl;

               

                cout << "Len: ";

                cin >> len;

                cout << endl;

               

                cout << "Year1: ";

                cin >> year1;

                cout << endl;

               

                cout << "You entered: " << title << " " << len << " " << year1 << endl;

               

                cout << endl;

                

                cout << "How many actors/characters do you want to add?" << endl;

                cout << "#: ";

                cin >> num_Peep;

               

               

           

                //Loop to pull in acts/ actresses

                

                for (int i = 0; i < num_Peep; i++)

                {

                    //Act and Actress

                    cout << "Act/Actress " << (i + 1) << "Name: ";

                    getline(cin, act);

                    cout << endl;

                   

                    //Character they play

                    cout << "Character they play: ";

                    getline(cin, charat_name);

                   

                   

                }

               

               

                //Store dvd information

               

                DVD.set_Title(title);

                DVD.set_Year1(year1);

                DVD.set_Len(len);

                DVD.addAct_Char(act, charat_name);

               

                

               

               

               

               

   

            }break;

           

           

   

    }

   

  

   

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote