Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an Intellij application with the following: Create an abstract class called Book. The class should declare the following variables: - an instance variable that

Write an Intellij application with the following:

image text in transcribedimage 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 0 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 getGenre0 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. 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 0 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 getGenre0 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

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

Students also viewed these Databases questions

Question

What roles have these individuals played in your life?

Answered: 1 week ago