Question: Create an abstract class called Book. The class should declare the following variables: - an instance variable that describes the title - String - an

Create an abstract class called Book. The class should declare the following variables: - an instance variable that describes the title - String - an instance variable that describes the ISBN - String - an instance variable that describes the publisher - String - an instance variable that describes the price - double - an instance variable that describes the year-integer Provide a toString( method that returns the information stored in the above variables. Create the getter and setter methods for each instance variable except price. Provide the necessary constructors. Include an abstract method setPrice (double price) to determine the price for a book. Include an abstract method getGenre(0 to return the genre of the book. Create two subclasses called ScienceBook and ChildrenBook. These subclasses should override the abstract methods setPrice and getGenre of class Book. Use the following rule for setting the price for a book: - science books will have a 10% discount per each book children books will have a fixed price (specified by user). Write a driver program (another class with main method) that uses the above hierarchy. In your driver program you must implement an interaction with the user. - Use showInputDialog method to let the user input book information. - Use showMessageDialog method to display book information including price and type for both science and children's books
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
