Hey guys I'm an absolute n00b so please be gentle. I'm having trouble with my project was hoping to see if I can get a push in the right direction.
I have to display information on a DVD that a user enters in, the last section where I have to have the Actor/Actress' name and their Character name added displayed. I'm not sure how to do this and my method that I have doesn't seem right.
"intructions"
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.
For the DVDs:
Movie Title
Length of Movie
Year Released
Actors/Actresses
Characters
Next I've got 3 options to Delete a DVD, Modify a DVD, and show all dvd's.... I don't even know where start, I'd appreciate a kick in the right direction..
Thanks guys, any help would be greatly appreciated!
#ifndef DVDHEADER_H
#define DVDHEADER_H
#include <iostream>
#include <vector>
#include <string>
usingnamespace std;
// DVD Class
class DVD
{
// variables
private:
string title; // dvd title
double length; // dvd length
int year; // dvd year released
public:
vector <string> charNames; // vector for character names
vector <string> actors; // vector for actors
DVD(); // constructor for the DVD
void setYear(int); // sets the Movie Year
void setLength(double); // sets the Movie length
void setTitle(string); // sets the Movie Title
void addActor(string, string); // add the actors/actresses name
string getTitle(); // gets the movie title
double getLength(); // gets the movie length
int getYear(); // gets the movie year
string getActor(unsignedint); // get actors
string getCharacter(unsignedint); // gets character name
// not sure if this if is the proper function....
//string getactchar(string, string);
};
#endif
*/
#include <iostream>
#include <string>
#include <iomanip>
#include <vector>
#include "DVDheader.h"
usingnamespace std;
int main()
{
// variables
string movieTitle; // stores title of movie
double movieLength; // stores length of movie
int yearReleased; // stores year of movie
int choice; // gets user's choice.
int numactors; // gets the number of actors
string actorname; // gets actors name
string charactername; // gets characters name
DVD myDVD; // DVD class object
// Welcome message
cout << "Welcome to Tom's DVD Collection Program" << endl;
cout << "==============================================\n\n" << endl;
// menu
cout << "What would you like to do with your DVD collection?" << endl;
cout << "(Please choose from the options below)" << endl;
cout << "=======================================================\n" << endl;
cout << "1. Add a new DVD" << endl;
cout << "2. Remove a DVD" << endl;
cout << "3. Update an existing DVD" << endl;
cout << "4. Show all DVD's in collection" << endl;
cout << "5. Exit" << endl;
cout << "========================================================" << endl;
cin >> choice;
switch (choice)
{
case 1:
cout << "You have chosen to add a new dvd, enter the information below\n" << endl;
// gets movie title
cout << "Please enter in the movie title of your DVD: ";
cin >> movieTitle;
// gets movie length
cout << "\nPlease enter in the movie length of your DVD (in minutes): ";
cin >> movieLength;
cout << "\nPlease enter in the year that your DVD was released: ";
cin >> yearReleased;
cout << "\nPlease enter in the number of actors that are in your movie: ";
cin >> numactors;
// loopage for actors
for (int i = 0; i < numactors; i++)
{
// get the actors/actress names
cout << "\nActor / Actress: " << (i + 1) << " Name: ";
cin >> actorname;
cout << "\nWhat Character name did " << actorname << " have? ";
cin >> charactername;
}
break;
// remove DVD
case 2:
// update DVD
case 3:
// show all
case 4:
// exit
case 5:
cout << "You have chosen to exit the program, thanks for using my program have a nice day!" << endl;
exit(1);
default: cout << "You must enter a number between 1 and 5" << endl;
break;
}
// DVD information storage
myDVD.setTitle(movieTitle);
myDVD.setLength(movieLength);
myDVD.setYear(yearReleased);
//myDVD.addActor(actorname, charactername);
cout << "\nHere is your Movie information: \n\n";
cout << "Movie Title: " << setw(10) << myDVD.getTitle() << endl;
cout << "Length of Movie: " << setw(6) << myDVD.getLength() << endl;
cout << "Year Released: " << setw(8) << myDVD.getLength() << endl;
cout << "\n";
// not sure what how to properly call this out here..
//cout << "Actors / Actress:" << myDVD.addActor(actorname,charactername) << endl;
}
Here is the second part of the instructions that has got me confused, again being a n00b.... not sure where to begin.
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.