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

CD/DVD Collection This program will allow the user to keep track of a CD or DVD

ID: 3578988 • Letter: C

Question

CD/DVD Collection

This program will allow the user to keep track of a CD or DVD collection. This can only work exclusively with either CDs or DVDs since some of the data is different—your choice. Each CD/DVD in the collection will be represented as a class, so you will have one class that is a single CD/DVD.

The CD class will use a vector 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 another vector. The class will also keep track of the total length of the CD. The class will also have a data member for the artist name and the name of the CD.

The DVD class will have data members for the title of the movie, the length of the movie, and the year the movie was released. The class will have a vector which is used to store the name of the actors and actresses in the movie. Another vector will be used to maintain the character names that the actor/actress played in the movie. These two vectors must work in parallel, meaning the first actor/actress in the list must correspond to the first character in the other vector.

The program will maintain a list of CD/DVDs. This list will be a vector of that class type (CD or DVD). 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.

For the DVDs:

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.

For the CDs:

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

DVD.h

#include <iostream>

#include <string>

#include <vector>

using namespace std;

class DVD   

{

private:

                string dvdtitle;            

                int launch_year;                 

                double dvd_size;           

public:

                vector<string> actorno;    

                vector<string> actorNames;      

                DVD()

                {

                                dvdtitle = " ";

                                dvd_size = 0;

                                launch_year = 0;

                }

                DVD(string titl, double len, int yr)

                {

                                DVDtitle = titl;

                                dvd_size = len;

                                launch_year = yr;

                }

                void setdvdtitle(string titl)

                {

                                dvdtitle;

                }              void setDvd_size(double len)

                {

                                dvd_size;

                }

                void setLaunch_year(int yr)

                {

                                launch_year;

                }

                string getdvdtitle() const

                {

                                return dvdtitle;

                }

                double getDvd_size() const

                {

                                return dvd_size;

                }

                int getLaunch_year() const

                {

                                return launch_year;

                }

                void addActor(string actors, string actorName)

                {

                                actorno.push_back(actors);      

                                actorNames.push_back(actorName);

                }

};

#include "DVD.h"

#include <iostream>

#include <string>

#include <vector>

#include <iomanip>

#include <map>

using namespace std;

int main()

{

                int choose;                                                           

                int num;

                string dvdtitle;                                     

                int launch_year;                  

                double dvd_size;

                string actorno;                                     

                string actorNames;  

                DVD myDVD;                                                        

                void show(string, double, int, string, string);

                void remove(string);

                void update(string);

                //Menu System

                cout<<” ”;

                cout << endl << endl;

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

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

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

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

                cout << "5. Exit" << endl;

                cin >> choice;

                switch (choose)

                {

                case 1:

                {

                cout << " enter the title, dvd_size, launch_year released, actors/actresses and their characters:" << endl;

                                cout << endl;

                                cout << “Title of Movie: ";

                                getline(cin, dvdtitle);

                                cout << endl;

                                cout << "Dvd_size: ";

                                cin >> dvd_size;

                                cout << endl;

                                cout << "Launch_year: ";

                                cin >> launch_year;

                                cout << endl;

                                cout << "You entered: " << title << " " << dvd_size << " " << launch_year << endl;

                                cout << endl;

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

                                cin >> number;

                                for (int count = 0; count < number; count++)

                                {

                                                cout << "Actor/Actress #" << (count + 1) << " Name: ";

                                                getline(cin, actorno);

                                                cout << endl;

                                                cout << "Character they play: ";

                                                getline(cin, actorNames);

                                }

                                myDVD.setTitle(dvdtitle);

                                myDVD.setLaunch_year(launch_year);

                                myDVD.setDvd_size(dvd_size);

                                myDVD.addActor(actor, characterName);

                }break;

                case 2:

                {

                                void removingDVD();

                                break;

                }

                case 3:

                {

                                void updatingDVD();

                                break;

                }

                case 4:

                {

                                void show();

                                break;

                }

                case 5:

                {

                                exit(0);

                }

                }}

void show(vector<string> &vectorActor, vector<string>&vectorCharNames, DVD *myDVD)

{

                // Formats the table for the output

                cout << setw(10) << " Movie Title: "

                                << setw(10) << "Dvd_size:"

                                << setw(10) << "Launch_year: "

                                << setw(10) << "Actors/Actresses:"

                                << setw(10) << "Characters: " << endl;

                   cout<<” ”;

                                for (auto count = 0; count < vectorActor.size(); count++)

                {

                                if (count < 1)

                                {

                                                if (myDVD[count].getDvd_size() != 0)

                                                {

                                                                cout << endl << setw(10) << right << myDVD[count].getTitle()

                                                                                << setw(10) << myDVD[count].getDvd_size()

                                                                                << setw(10) << myDVD[count].getLaunch_year();

                                                }

                                                else

                                                {

                                                                cout << setw(10) << right << myDVD[count].getTitle();

                                                }

                                }

                                else

                                {

                                if (myDVD[count].getDvd_size() != 0)

                                                {

                                                                cout << endl << setw(10) << right << myDVD[count].getTitle()

                                                                                << setw(10) << myDVD[count].getDvd_size()

                                                                                << setw(10) << myDVD[count].getLaunch_year();

                                                }

                                                else

                                                {

                                                                cout << setw(10) << right << myDVD[count].getTitle();

                                                }

                                }

                                if (count < 1)

                                                cout << " " << vectorActor[count]

                                                << " " << vectorCharNames[count] << endl;

                                else

                                {

                                                cout << " " << vectorActor[count]

                                                                << " " << vectorCharNames[count] << endl;

                                }

                }}

void RemoveDVD(string, class DVD &myDVD)

{

    cout << " Enter the Movie Title you would like to remove: ";

    string title = "";

    cin.sync();

    getline(cin, title);

    map<string,DVD>::iterator result = myDVD.find(title);

    if (result == myDVD.end())

    {

        cout << " No records found. None were removed.";

        return;

    }

    cout << " This dvd was found:";

    (*result).second.listDVDData(cout);

    char confirm;

    cout << " Confirm removal(y/n): ";

    cin >> confirm;

    if (tolower(confirm) == 'y')

    {

        myDVD.erase(result);

    }

};

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