Question
USE C++ Create an application for a video rental business. The application has an abstract class named Movie. The Movie class has fields movie ID,
USE C++
Create an application for a video rental business. The application has an abstract class named Movie. The Movie class has fields movie ID, movie title, rentPerDay and a pure virtual function calcFee(). Create three additional classes named Action, Comedy, and Drama that are derived from Movie. Each of the subclasses will override the calcFee() that takes as input the number of days a movie was on rent and calculates the rent. The fee for Action movies is Rs. 20/day, comedies are Rs. 40/day, and dramas are Rs. 30/day. However, Rs. 10 would be charged as late fee per day if the movie has been kept for more than 3 days. In main method create an array of pointers of Movie class and create objects of Action, Comedy, and Drama classes. Invoke the calcFee() method for each type of subclasses in a polymorphic manner.
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