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.
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
Related questions
Concept explainers
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 7 images
Knowledge Booster
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education