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() function.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
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 () function.
Transcribed Image Text: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 () function.
Expert Solution
steps

Step by step

Solved in 4 steps with 7 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education