Hey Guys I was wondering if anyone can help me with this assignment like completely walk me through it? I would really greatly appreciate it....... I have tried doing it and have came up with nothing. I have been having a lot of trouble understanding this material this school year. Here is what I have to do:


1. Create a user-defined data type (class) to represent a movie. A movie has
several characteristics. You need to represent at least the following:

1) Title
2) Year
3) Director
4) Genre


Provide at least the following functions:

1) Constructor that takes the title, year, director and genre and initializes an object
2) Destructor
3) Four functions to retrieve the title, year, director and genre respectively for an object

4) Function to display details of a movie

Write a main function to demonstrate each function in the above class.

2. Create a user-defined data type called “MovieDatabase” to store and search
for movie information. This class needs to store a list of movies (store pointers to the Movie class created in Question 1 in a appropriate data structure such as vector, list, etc.). In addition, provide at least the following functions:

1) Default constructor (Note: a default constructor is one that does not take any
parameters) and destructor

2) Function to add a new movie to the database
3) Functions to search for a movie:

1. Search by title – displays a list of movies with given title
2. Search by year – displays a list of movies for given year
3. Search by director – displays a list of movies for given director
4. Search by genre – displays a list of movies for given genre

Write a main function to demonstrate each function in the above class. To demonstrate the search functionality, make sure you add at least four movies into your database before searching.

Note: Although we are writing a “database” class, we are currently not attempting any
persistent storage (writing to a file or a real database which stays alive even after your program quits).

Extra credit option:

Enhance your search functionality by providing at least two functions that can
search by more than one parameter (ex., search by year and by director, search by year and by genre, etc.). Update your main function to demonstrate the new functions.

Recommended Answers

All 3 Replies

Read the rules. No homework dumps. You need to post an attempt and ask a specific question.

#ifndef MOVIE_H
#define MOVIE_H
#include<string>

using namespace std;

class movie
{
friend ostream& operator<< (ostream&, const movie &);
friend istream& operator>> (istream&, movie &);

public:
void print() const;
void setName(string);
string getMovieNameList() const;
string getMovieYearList() const;
movie(string name = "", string year = "");

private:
string nameList;
string yearList; 
};

this is all that I have in terms of code at this point

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.