Question
In this programming project, you will implement a hierarchy of classes as described and, utilizing polymorphism, objects of the classes are exercised in a client
In this programming project, you will implement a hierarchy of classes as described and, utilizing
polymorphism, objects of the classes are exercised in a client program. Design a class hierarchy consisting of Publication, Magazine, Book, and KidsMagazine classes as described
below.
A Publication has a publisher, number of pages, a price, and a title. The class should implement a
toString() method that displays all of this information. This class should be abstract.
A Magazine is a kind of publication that has a publication unit (monthly, weekly, bi-
weekly). Magazine should have toString() that display all the information.
A Book is a kind of publication that has an author. Book should also have toString().
A KidsMagazine is a kind of magazine that has a recommended age range. Again, KidsMagazine should have toString().
Implement a client class that stores 8 different types of publications: magazine, book, or kids magazine in an array of Publication. Exploit polymorphism and print the information about each object stored in the array.
To submit this weekly exercise, gather all *.java source-code files that have been created for the above classes (in Eclipse, you can find these files in src folder under the folder that has been created for this Java project), place them in a folder, zip/compress and attach the folder.
Step 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