Answered step by step
Verified Expert Solution
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:
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
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