Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab Homework #2: The Movie Collection Object In this homework assignment, we are going to define a Movie class and use a collection of Movie
Lab Homework #2: The Movie Collection Object In this homework assignment, we are going to define a Movie class and use a collection of Movie objects. By using a vector collection variable (also implemented as a class), we are going to implement a number of operations. You are given a template program file that you can extend to complete the requirements of the assignment. Basically, we are going to make use of the following class in order to keep a record of a list of Movies. We want to incorporate the Movie class to create new Movie objects and store them in a Movie collection variable. The Movie collection is also a class that is comprised of a set of functions. A vector of Movie objects in the member variable of the Movie Collection class. Further, by using the vector variable we want to be able to do a set of tasks. These tasks will be implemented inside the Movie Collection class. The declaration of the Movie Collection class is shown in the following: //Movie class: with all inline methods class Movie { private: std::string title; // title with space allowed unsigned year; il positive value public: void settitle(std::string n) { title = n; } std::string gettitle() { return title; } void setyear(int year_param) { year = year_param; } int getyear() { return year; } // creating a single string value out of // all the fields of the Movie object std::string to_string() { std::string result = title + "(". std::to_string(year) +")"; return result; } }; // Movie class ends. Use the given template file and complete the functions of the Movie Collection class in order to achieve the following tasks (inside the code, we have provided written comments to describe the steps you should do to complete the functions): // this collection class employs a vector variable to store // Movie records class MovieCollection { private: std::vector
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started