You will create an inheritance set of classes use proper


Problem

You will create an inheritance set of classes. Use proper rules for data types, class definitions, and inheritance (check input/output of data below). You will create a super media class that will define a general form of media. A media properties will consist of the name and price. The media should be able to construct itself out of the arguments sent to it, virtually print both data fields labeled (price to two decimal places) and overload the < operator to compare two medias by comparing their name field.

You will then create two subclasses of media for a movie and a book. A movie "is a" media, but also has a rating. It also should construct itself by initializing all data fields, but use the super media constructor to initialize the inherited data fields. It will also override the media print function. In the new version, it should print that it is a movie, then call the super print function to print the name and price, then print the new labeled rating data field itself.

A book "is a" media, but also has an author and will be set up similar to a movie. It also should override the media print function. In the new version, it should print that it is a book, then call the super print function to print the name and price, then print the new labeled author data field itself.

You will then create a main class that will declare an array of three super media pointers (so you can combine movies and books together in the array). Then using a loop, prompt and input all the data fields (asking the user what kind of media for what added data to input). At the end of the loop, construct the next (proper type) object and assign it into the array. Put a blank line between prompts for the input objects.

When the input loop is over, call a function in the main program that will selection sort the array of media pointers. Use the overloaded < operator to perform the sort on the name field of the calling object.

In a separate loop, call the print function (with dynamic binding!). Put a blank line between output objects.

Run your program with the data below and create the output as shown below. Submit your three class definitions, main program, and output text file. Document all files with at least 4 lines of comments at the top and at least 5 comments throughout the code for all of the not easily understandable lines of code.

Request for Solution File

Ask an Expert for Answer!!
Business Management: You will create an inheritance set of classes use proper
Reference No:- TGS02781025

Expected delivery within 24 Hours