Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions