Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Do it in c++ using oop techniques. Question #1: Declare and implement the abstract class Media. This class will have a protected member variable title
Do it in c++ using oop techniques.
Question #1: Declare and implement the abstract class Media. This class will have a protected member variable title (of char * type) to store the title of the media item. Apart from the overloaded constructor, Media class will have a pure virtual function display (). . Inherit three classes from the Media class, namely: Book, Magazine, and CD. 1. The Book class will have authorName (char *) and ISBN (char *) of the book. 2. The Magazine class will have monthName (char *) and year (int) of publication of the magazine. 3. The CD class will have an integer member variable to store its capacity in MBS. Add a Shelf class to store a list of Media items. So, Shelf class has Items (Media **), currSize (int), maxSize (int) data members. It will have the following functions: void insert (Media*); void displayContents(); The overloaded constructor will take an integer value as argument and initialize the maxSize to that value, and initialize currSize to 0. Constructor will also dynamically allocate an array of Media* through the member variable items. Now, implement a main function which should ask the user how many Media items the user wants to create, and declares a Shelf object to store those many items. Create a menu on screen on which the user should be asked to enter 1 if he/she wants to create a Book and 2 if he/she wants to create a Magazine, 3 if he/she wants to create a CD, and 4 if he/she wants to print details of objects in the shelf. 1. If choice 1, 2, or 3 has been entered, your program should ask the user for all the attributes necessary for creating that item (Book, Magazine, or CD). Then, that item should be dynamically allocated and passed to insert method of shelf. 2. If the user has entered 4, then details of media items should be displayed by calling the displayContents() functionStep 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