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

**NEED HELP FINISHING- GETTING STUCK** This program will allow the user to keep

ID: 672817 • Letter: #

Question

**NEED HELP FINISHING- GETTING STUCK**

This program will allow the user to keep track of a DVD collection. Each DVD in the collection will be represented as a class, so you will have one class that is a single DVD.

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.

**HERE IS WHAT I HAVE SO FAR. PARTIALLY WORKING**

//HEADER

#include
#include
#include

using namespace std;

class DVD
{
private:
   string _title; //DVD title
   int _year;       //Year Released
   int movieLength;//Movie Length
   int num_actors; //number of actors/characters

public:

   //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
   vector actor; // store the name of the actors and actresses in the movie
   vector charName; // maintain the character names that the actor/actress played in the movie


   //Function for displaying DVD list
   void display();

   //Functions for adding, removing, and updating the DVD's
   //void addDVD();
   //void deleteDVD();
   //void updateDVD();


   //Default Constructor
   DVD(string t = "",int l = 0,int y = 0)
   {

       _title = t;
       movieLength = l;
       _year = y;
   }


   // Mutators

   // Accessors
   string DVD::getMovie() const
   {
       return _title;
   }
   double DVD::getLength() const
   {
       return movieLength;
   }
   int DVD::getYear() const
   {
       return _year;
   }

};
//Function to display things like name, year etc.
void DVD::display()
{
   cout << "Movie Title" << _title;
   cout << "Length of Movie" << movieLength;
   cout << "Year Released" << _year;
   //cout << "Actors/Actresses" << actor.push_back;
   //cout << "Characters" << charName.push_back;
     
}

//CPP

#include "DVD.h"
#include
#include
#include

using namespace std;


int main()

{

   string title;           // To hold movie title
   int movieLength;       // Local variable for length
   int yearReleased; // Local variable for release date
   int choice;               // For menu choice
   int quantity;           //storing number of actors

   vectorvalues;   //store actors to vector
   string name; // To hold actor/actress name
   string charN; // To hold name of character

   DVD mydvd;               //define DVD object

   //Menu System
   cout << "********************************************" << endl;
   cout << "************** DVD Collection **************"<< endl;
   cout << "********************************************" << endl;
   cout << endl;
   cout << "1. Display DVD's" << endl;
   cout << "2. Add DVD"<< endl;
   cout << "3. Remove DVD" << endl;
   cout << "4. Update DVD" << endl;
   cout << "5. QUIT" << endl;


   cout << endl;
   cout << "Enter a choice: ";
   cin >> choice;
   cout << endl;

   // Constants for menu choices
   const int SHOW_LIST = 1,
           ADD_DVD = 2,
           REMOVE_DVD = 3,
           UPDATE_DVD = 4,
           QUIT_CHOICE = 5;

   switch (choice)
   {

   //choice 1
       //case SHOW_LIST


       //   break;

   //choice 2
   case ADD_DVD:

           cout << "(You chose to add a DVD)" << endl;
           // Ask the user to enter the details of DVD
           cout << "Enter the movie title: ";
           cin >> title;
           cout << endl;
           cout << "Enter the movie length: ";
           cin >> movieLength;
           cout << endl;
           cout << "Enter the year released: ";
           cin >> yearReleased;
           cout << endl;

           cout << "How many actors would you like to add? ";
           cin >> quantity;

           //Retreive actor and character names in parallel
           for (int index = 0; index < quantity; index++)
           {
               cout << "Enter actor #" << (index + 1) << ": ";
               cin >> name;
               values.push_back(name);

               cout << "Enter the name of the character portrayed "
                   << "by actor #" << (index + 1) << ": ";
               cin >> charN;
               values.push_back(charN);

           }

           cout << endl;


          
           break;

           //choice 3
           //case REMOVE_DVD
          

           //break;


           //choice 4
           //case UPDATE_DVD

           //break;


           //choice 5
           //case QUIT_DVD
           //break;

   default:
       cout << "The valid choices are 1 through 5." << endl;

   } //end choices


   return 0;

}

Explanation / Answer

#include "DVD.h"
#include <iostream>
#include <string>
#include <vector>

using namespace std;

class DVD
{
private:
   string __title; //DVD _title
   int __year;       //_year Released
   int moviemovieLength;//Movie movieLength
   int num_actors; //number of actors/characters

public:

   //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
        vector<string> actrs;     //Actors and Actresses
        vector<string> charNames; // maintain the character names that the actor/actress played in the movie


   //Function for displaying DVD list
   void display();
   void set_title(string);
   void setmovieLength(double);
   void set_year(int);
   void addActChar(string, string);
   string get_title();
   double getmovieLength();
    int get_year();

   //Functions for adding, removing, and updating the DVD's
   //void addDVD();
   //void deleteDVD();
   //void updateDVD();


   DVD()          
       {
           _title = "";
           _year = 0;
           movieLength = 0;
         
         
       }  
};

   Header fIle

   #include <iostream>
   #include "DVD.cpp"
   #include <vector>
   #include <string>

DVD DVD;

void DVD::setTitle(string t)
{
      title = t;
}


void DVD::setLength(double l)
{
      length = l;
}

void DVD::setYear(int y)
{
      year = y;
}


void DVD::addActChar(string actrs, string charNames)
{
    
      actor.push_back(actrs);       //Undeclared identifier 'actor'
    
      charat.push_back(charNames); //Undeclared identifier 'charat'
    
    
      //pushback character
    
}


//Function to display things like name, _year etc.
void DVD::display()
{
   cout << "Movie _title" << __title;
   cout << "movieLength of Movie" << moviemovieLength;
   cout << "_year Released" << __year;
   //cout << "Actors/Actresses" << actor.push_back;
   //cout << "Characters" << charName.push_back;
   
}

//CPP

#include "DVD.h"
#include "DVD.cpp"
#include <iostream>
#include <string>
#include <vector>

using namespace std;


int main()

{

   string _title;           // To hold movie _title
   int moviemovieLength;       // Local variable for movieLength
   int _yearReleased; // Local variable for release date
   int choice;               // For menu choice
   int quantity;           //storing number of actors

   vectorvalues;   //store actors to vector
   string name; // To hold actor/actress name
   string charN; // To hold name of character

   DVD mydvd;               //define DVD object

   //Menu System
   cout << "********************************************" << endl;
   cout << "************** DVD Collection **************"<< endl;
   cout << "********************************************" << endl;
   cout << endl;
   cout << "1. Display DVD's" << endl;
   cout << "2. Add DVD"<< endl;
   cout << "3. Remove DVD" << endl;
   cout << "4. Update DVD" << endl;
   cout << "5. QUIT" << endl;


   cout << endl;
   cout << "Enter a choice: ";
   cin >> choice;
   cout << endl;

   // Constants for menu choices
   const int SHOW_LIST = 1,
           ADD_DVD = 2,
           REMOVE_DVD = 3,
           UPDATE_DVD = 4,
           QUIT_CHOICE = 5;

   switch (choice)
   {


   //choice 1
    Case SHOW_LIST
    
               cout << "(You chose to add a DVD)" << endl;
                      // Ask the user to enter the details of DVD
                      cout << "Enter the movie title: ";
                      cin >> title;
                      cout << endl;
                      cout << "Enter the movie length: ";
                      cin >> movieLength;
                      cout << endl;
                      cout << "Enter the year released: ";
                      cin >> yearReleased;
                      cout << endl;
         
                      cout << "How many actors would you like to add? ";
                          cin >> quantity;
   case ADD_DVD:

           cout << "(You chose to add a DVD)" << endl;
           // Ask the user to enter the details of DVD
           cout << "Enter the movie _title: ";
           cin >> _title;
           cout << endl;
           cout << "Enter the movie movieLength: ";
           cin >> moviemovieLength;
           cout << endl;
           cout << "Enter the _year released: ";
           cin >> _yearReleased;
           cout << endl;

           cout << "How many actors would you like to add? ";
           cin >> quantity;

           //Retreive actor and character names in parallel
           for (int index = 0; index < quantity; index++)
           {
               cout << "Enter actor #" << (index + 1) << ": ";
               cin >> name;
               values.push_back(name);

               cout << "Enter the name of the character portrayed "
                   << "by actor #" << (index + 1) << ": ";
               cin >> charN;
               values.push_back(charN);

           }

           cout << endl;
         
              // Choice 3
            
      Case REMOVE_DVD:
    
                 cout << "(You chose to add a DVD)" << endl;
                 // Ask the user to enter the details of DVD
                 cout << "Enter the movie _title: ";
                 cin >> _title;
                 cout << endl;
                 cout << "Enter the movie movieLength: ";
                 cin >> moviemovieLength;
                 cout << endl;
                 cout << "Enter the _year released: ";
                 cin >> _yearReleased;
                 cout << endl;
    
                 cout << "How many actors would you like to add? ";
                 cin >> quantity;
    
                 //Retreive actor and character names in parallel
                 for (int index = 0; index < quantity; index--)
                 {
                     cout << "Enter actor #" << (index - 1) << ": ";
                     cin >> name;
                     values.push_back(name);
    
                     cout << "Enter the name of the character portrayed "
                         << "by actor #" << (index - 1) << ": ";
                     cin >> charN;
                     values.push_back(charN);
    
                 }
    
                 cout << endl;
         
           
       
            


   default:
       cout << "The valid choices are 1 through 3." << endl;

   } //end choices

            
   return 0;

}