Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
C++ Program for Managing Personal Movie Collections

Goal

For this assignment, you will write a C++ program to manage personal movie collections. You will practice writing simple classes in C++, as as well working with dynamically allocated memory.

With this assignment, you will:

• write code with simple C++ classes, and implement a collection clas

• work with dynamically allocated memory and pointer

• write and package a program following standard Unix programming conventions 

1. Modify the Movie class

You will begin with the Movie class that we worked on during the lectures. You can find this class in the coding examples posted in cuLearn, in section 1.5, program #5 (S1.5.CtorDtor/p5-Movie-conv). You will be modifying this class to add some data members and functions, and to remove others. Modify the Movie class as follows:

(1) remove the screenwriter and duration data members, and add a new data member for the year that the movie was made (this will be represented as an integer); modify the constructor accordingly

(2) modify the print() function so that it prints the all correct data members (title and year)

(3) remove the conversion constructor, and implement a copy constructor

(4) implement a getter for the year data member; you will need this member function in a later step, in order to find the correct position to add a movie to a movie group

2. Implement the MovieGroup class

You will create a new MovieGroup class that manages a primitive array of movies and provides the required member functions to manipulate those movies. The MovieGroup class will contain the following:

(1) a data member that holds the movie collection

(a) this will be a statically allocated array of Movie object pointers

(b) you will define a preprocessor constant for the maximum number of movies; this can be set to a reasonable number such as 64

(c) you can refer to the coding example in section 1.6, program #5, for examples of the four different kinds of arrays

(2) a data member to track the current number of movies in the array

(3) a constructor that initializes the current number of movies

(4) a destructor that deallocates the dynamically allocated movies contained in the array

(5) a copy constructor that performs a deep copy of the movie group; using correct design principles, this function must call the Movie copy constructor to create a copy of each Movie object

(6) a print() member function that prints out every Movie object contained in the array; using correct design principles, this function must call the print() function of each Movie object

(7) a void add(Movie* m) member function that adds the given movie m to the array in its correct place, in ascending (increasing) order by year (a) you must shift the elements in the array towards the back of the array to make room for the new element in its correct place; do not add to the end of the array and sort; do not use any sorting function or sorting algorithm (b) you must perform all basic error checking

(8) a void merge(MovieGroup& mg) member function that takes every movie in the parameter movie group mg, makes a copy of the movie (using the Movie copy constructor), and adds that movie to the array (a) for example: assuming two movie groups mg1 and mg2, if we have the following function call: mg1.merge(mg2); then every movie in mg2 will be copied and the copy added to mg1; as a result, mg1 will contain all of its own original movies, plus copies of all the movies found in mg2, all organized in ascending order by year (b) you must reuse existing functions everywhere possible, specifically the add() function (c) you must perform all basic error checking

3. Write the main and initialization functions

Your main() function must test your program thoroughly. It will declare two movie groups, and initialize them with different movies. It will make a copy of one of the movie groups, and merge this new copy with the other group, so that the copy becomes a “super” group containing all the movies. At the end of the program, it will print all three movie groups. You will write the void initMovies(MovieGroup&, MovieGroup&) global function that initializes two groups of movies. This initialization function will do the following:

(1) dynamically allocate Movie objects for at least 28 different movies, without duplicate information

(2) initialize the two movies groups with at least 15 movies each

(3) a maximum of two movies can be in both groups

(4) the movies must be added to each group in different order of years, so that the movie group’s add() member function is thoroughly tested 

support
close