Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Ability to work comfortably in a team environment

Answered: 1 week ago

Question

Exposure to SQL desirable but not required

Answered: 1 week ago