wont compile say my get functions not declared in this scope
Movie.cpp
#include "Movie.h" #include "Text.h" Movie::Movie(const char* title, int length) { //assign parameter data to structure memebers setMovieTitle(title); setMovieLength(length); } Movie::Movie(const char *title, int length, int year, const char *genre, const char* rating, int oscars, float stars) { setMovieTitle(title); setMovieLength(length); setMovieYear(year); setMovieGenre(genre); setMovieRating(rating); setMovieOscars(oscars); setMovieNumStars(stars); } Movie::~Movie() { delete movieTitle; delete movieGenre; delete movieRating; } void printMovieDetails() { cout << endl; cout << right << setw(30) << "Movie Title: " << left; cout << getMovieTitle(); cout << endl; cout << right << setw(30) << "Length (minutes): " << left << getMovieLength() << endl; cout << right << setw(30) << "Year Released: " << left << getMovieYear() << endl; cout << right << setw(30) << "Genre: " << left; cout << getMovieGenre(); cout << endl; cout << right << setw(30) << "Rating: " << left; cout << getMovieRating(); cout << endl; cout << right << setw(30) << "Number of Oscars Won: " << left << getMovieOscars() << endl; cout << right << setw(30) << "Number of Stars: " << left << getMovieNumStars() << endl << endl; } void printMovieDetailsToFile(ofstream &outFile) { char temp[1000]; strncpy(temp,getMovieTitle(), 1000); outFile << temp << endl; outFile << getMovieLength() << endl; outFile << getMovieYear() << endl; strncpy(temp,getMovieGenre(), 1000); outFile << temp << endl; strncpy(temp,getMovieRating(), 1000); outFile << temp << endl; outFile << getMovieOscars() << endl; outFile << getMovieNumStars() << endl; } void editMovie() { int choice; Text* tempText; char temp[100]; int length; int year; int oscars; float stars; do { cout << " Which detail do you wish to edit? "; cout << "1. Title "; cout << "2. Length "; cout << "3. Year "; cout << "4. Genre "; cout << "5. Rating "; cout << "6. Number of Oscars Won "; cout << "7. Number of Stars "; cout << "8. DONE EDITING "; cout << "CHOOSE 1-8: "; cin >> choice; while(choice < 1 || choice > 8) { cout << " OOPS! Enter choice 1 through 8: "; cin >> choice; } cin.ignore(); switch(choice) { case 1: cout << " Current Title: "<editText(temp); break; case 2: cout << " Current Length: " <> length; setMovieLength(length); break; case 3: cout << " Current Year: " << getMovieYear(); cout << " NEW LENGTH: "; cin >> year; setMovieYear(year); break; case 4: cout << " Current Genre: "<editText(temp) ; break; case 5: cout << " Current Rating: "<editText(temp); break; case 6: cout << " Current Number of Oscars Won: " << getMovieOscars(); cout << " NEW NUMBER OF OSCARS: "; cin >> oscars; setMovieOscars(oscars) break; case 7: cout << " Current Star Rating from IMDB: " << getMovieNumStars(); cout << " NEW STAR RATING: "; cin >> stars; setMovieNumStars(stars); break; } }while(choice != 8); } const char*Movie::getMovieTitle() const { return movieTitle->getText(); } int Movie::getMovieLength() const { return movieLength; } int Movie::getMovieYear() const { return movieYear; } const char*Movie::getMovieGenre() const { return movieGenre->getText(); } const char* Movie::getMovieRating() const { return movieRating->getText(); } int Movie::getMovieOscars() const { return movieOscars; } float Movie::getMovieNumStars() const { return movieNumStars; } void Movie:: setMovieTitle(const char* title) { Text* temp= new Text(title); movieTitle=temp; } void Movie::setMovieLength(int length) { movieLength= length; } void Movie::setMovieGenre(const char* genre) { Text* temp = new Text(genre); movieGenre=temp; } void Movie::setMovieRating(const char* rating) { Text* temp=new Text(rating); movieRating = temp; } void Movie::setMovieOscars(int oscars) { movieOscars = oscars; } void Movie::setMovieNumStars(float stars) { movieNumStars= stars; }
Movie.h
#ifndef Movie_h #define Movie_h #include "Text.h" #include #include #include #include using namespace std; class Movie { private: Text *movieTitle; //title of movie int movieLength; //length of movie in minutes int movieYear; //year released Text *movieGenre; //comedy, horror, sci-fi, fantasy, romance, thriller, drama, action, biography Text *movieRating; //G, PG, PG-13, R, MA int movieOscars; //number of oscars won float movieNumStars; //taken from IMDB on 10 star scale public: /* Function name: createMovie (overloaded function) Parameters: 1) A pointer to a Text variable, containing a c-string and the length of the string. 2) An integer containing the length of the movie Returns: A pointer to a new Movie structure Purpose: This function should be called when only the title of the movie and the length of the movie is known and it will create a new movie with this information. */ Movie(const char *, int); /* Function name: createMovie (overloaded function) Parameters: 1) A pointer to a Text variable, containing the title of the movie 2) An integer containing the length of the movie 3) An integer containing the year the movie was released 4) A pointer to a Text variable, containing the genre of the movie 5) A pointer to a Text variable, containing the rating of the movie 6) An integer containing the number of oscars the movie won 7) A float containing the IMDB rating of the movie (out of 10 stars) Returns: A pointer to a new Movie structure Purpose: This function should be called when all movie information is known and it will create a new movie with this information. */ Movie(const char *, int, int, const char *, const char*, int, float); /* Function name: editMovie Parameters: A pointer to a movie structure Returns: nothing (void) Purpose: This function should be called when the user wants to edit a single movie's data */ void editMovie(); /* Function name: destroyMovie Parameters: A pointer to a movie structure Returns: nothing (void) Purpose: This function should be called when there is no longer need for the movie in the database (like when removing or deleting a movie). */ ~Movie(); /* Function name: printMovieDetails Parameters: A pointer to a movie structure Returns: nothing (void) Purpose: This function should be called when the user wants to print ALL the movie information to the screen. */ void printMovieDetails(); /* Function name: printMovieDetailsToFile Parameters: A pointer to a movie structure, a file stream object (sent by reference) Returns: nothing (void) Purpose: This function should be called when the user wants to print ALL the movie information to the file. */ void printMovieDetailsToFile(ofstream &); const char* getMovieTitle() const; /* Title: getMovieTitle Parameter:none Return:Returns a c-string Purpose: returns movie title */ int getMovieLength() const; /* Title: getMovieLength Parameter:none Return:Returns a integer Purpose: returns movie length */ int getMovieYear() const; /* Title: getMovieYear Parameter:none Return:Returns a integer Purpose: returns movie year */ const char* getMovieGenre() const; /* Title: getMovieGenre Parameter:none Return:Returns a c-string Purpose: returns movie genre */ const char* getMovieRating() const; /* Title: getMovieRating Parameter:none Return:Returns a c-string Purpose: returns movie title */ int getMovieOscars() const; /* Title: getMovieOscars Parameter:none Return:Returns a integer Purpose: returns movie Oscars awarded */ float getMovieNumStars() const; /* Title: getMovieNumStars Parameter:none Return:Returns a integer Purpose: returns movie number of stars awarded */ void setMovieTitle(const char*); /* Title: setMovieTitle Parameter:none Return:none Purpose: access title */ void setMovieLength(int); /* Title: setMovieLength Parameter:none Return:none Purpose: access length */ void setMovieYear(int); /* Title: setMovieYear Parameter:none Return:none Purpose: access year */ void setMovieGenre(const char*); /* Title: setMovieGenre Parameter:none Return:none Purpose: access genre */ void setMovieRating(const char*); /* Title: setMovieRating Parameter:none Return:none Purpose: access rating */ void setMovieOscars(int); /* Title: setMovieOscars Parameter:none Return:none Purpose: access oscars */ void setMovieNumStars(float); /* Title: setMovieNumStars Parameter:none Return:none Purpose: access number of stars */ }; #endif