Question: 1. GetFlix Video uses classes and objects to keep track of their movie rentals. Below is the class definition for a Video class. class Video{

1. GetFlix Video uses classes and objects to keep track of their movie rentals. Below is the class definition for a Video class.

class Video{

public:

Video (char* = "", char* = "", int = 0); char* get_name () {return name;} char* get_tapeid (){return id;} void check_out (int num) {number_on_hand -= num;} void return_movie (int num){number_on_hand += num;} void print();

private: char* name;

char* id; int number_on_hand;

};

a. Write the constructor for class Video. Keep in mind that the number_on_hand should never be a negative number!!

b. If the method for function print were defined as follows:.

void Video::print() {

cout << name << endl; cout << id << endl; cout << number_on_hand << endl;

} What would be printed from the following C++ program?

#include #include "video.h" using namespace std;

int main() {

Video movie ("Fargo", "F455", 15); Video movie2("The Big Stuff", "S123"); movie.print(); movie2.print(); movie.check_out(3);

movie.print();

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!