The goal of this coding exercise is to create two classes BookstoreBook and LibraryBook that both extend the class Book. The class Book is to be made abstract and to have these private attributes: author: String tiltle: String isbn: String To the Book class, add the abstract method: public String getBookType(); The BookstoreBook has an additional data member to store the price of the book, and whether the book is on sale or not If a bookstore book is on sale, we need to add the reduction percentage (like .2 off...etc). For that, add double price, boolean onSale and double saleRate as private fields to the BookstoreBook class. Obviously, saleRate is 0.0 when onSale is false. In the LibraryBook class, we add Subject and callNumber as String. The call number is automatically generated by the following procedure: The callNumber has the format S.XX.YYY.C, where S is the subject code. The list of subject codes is provided at the end of this document, XX is the floor number that is randomly assigned (our library has 15 floors: 01, 02,...15), YYY are the first three letters of the author's name (we assume that all names are at least three letters long), and C is the last character of the isbn. For example, Q.09.JON.T is the call number for a Science book that is located on the 9th floor of the library and whose author's name starts with JON. The isbn of that book ends with the character T. In each of the three classes mentioned above, add the setters, the getters, at least two constructors (of your choosing). Override the toString method in the class Book to return a string containing the isbn, author and the title. In the BookstoreBook and LibraryBook classes, override the toString to add the additional information to the returned string, using super.toString(). The format of the string returned by the toString methods is shown on the sample run below. Additionally, each of the sub-classes must override getBookType to return "Library Book" or "Bookstore Book." This method may be used whenever you are in need to tell if a book is a bookstore or a library book. Feel free to add private methods to any of the classes to avoid code redundancy. Your code should handle up to 100 books. For this, your code must use one array of type Book (not an ArrayList nor any built-in data structure class) in which you reference objects of both classes BookstoreBook and LibraryBook. The sample run below should give you a clear idea about how to code everything! Sample Run Welcome to the book program! Would you like to create a book object? (yes/no): yEs (yEs, Yes,..., No, NO,nO...etc all acceptable entries) Enter the author, title and the isbn of the book separated by /: Ericka Jones/Java made Easy/458792132 Got it! Now, tell me if it is a bookstore book or a library book (enter BB for bookstore book or LB for library book): BSB (Lb, bB...etc all acceptable entries) Oops! That's not a valid entry. Please try again: Bookstore Oops! That's not a valid entry. Please try again: bB Got it! Enter the list price of JAVA MADE EASY by ERICKA JONES: 14.99 Is it on sale? (yes/no): yes (yEs, Yes,..., No, NO,nO...etc all acceptable entries) Deduction percentage: 15% (Enter this as a percentage) Got it! Here is your bookstore book information [458792132-JAVA MADE EASY by ERICKA JONES- $14.99 listed for $12.74] (this output is what the toString() returns) If Java Made Easy wasn't on sale, your code should print: [458792132-JAVA MADE EASY by ERICKA JONES, $14.99] Would you like to create a book object? (yes/no): yeah Oops! That's not a valid entry. Please try again: yes Enter the author, title and the isbn of the book separated by /: Eryc Jones/Java as a healing language/95879213m Got it! Now, tell me if it is a bookstore book or a library book (enter BB for bookstore book or LB for library book): LB
The goal of this coding exercise is to create two classes BookstoreBook and LibraryBook that both extend the class Book. The class Book is to be made abstract and to have these private attributes: author: String tiltle: String isbn: String To the Book class, add the abstract method: public String getBookType(); The BookstoreBook has an additional data member to store the price of the book, and whether the book is on sale or not If a bookstore book is on sale, we need to add the reduction percentage (like .2 off...etc). For that, add double price, boolean onSale and double saleRate as private fields to the BookstoreBook class. Obviously, saleRate is 0.0 when onSale is false. In the LibraryBook class, we add Subject and callNumber as String. The call number is automatically generated by the following procedure: The callNumber has the format S.XX.YYY.C, where S is the subject code. The list of subject codes is provided at the end of this document, XX is the floor number that is randomly assigned (our library has 15 floors: 01, 02,...15), YYY are the first three letters of the author's name (we assume that all names are at least three letters long), and C is the last character of the isbn. For example, Q.09.JON.T is the call number for a Science book that is located on the 9th floor of the library and whose author's name starts with JON. The isbn of that book ends with the character T. In each of the three classes mentioned above, add the setters, the getters, at least two constructors (of your choosing). Override the toString method in the class Book to return a string containing the isbn, author and the title. In the BookstoreBook and LibraryBook classes, override the toString to add the additional information to the returned string, using super.toString(). The format of the string returned by the toString methods is shown on the sample run below. Additionally, each of the sub-classes must override getBookType to return "Library Book" or "Bookstore Book." This method may be used whenever you are in need to tell if a book is a bookstore or a library book. Feel free to add private methods to any of the classes to avoid code redundancy. Your code should handle up to 100 books. For this, your code must use one array of type Book (not an ArrayList nor any built-in data structure class) in which you reference objects of both classes BookstoreBook and LibraryBook. The sample run below should give you a clear idea about how to code everything! Sample Run Welcome to the book program! Would you like to create a book object? (yes/no): yEs (yEs, Yes,..., No, NO,nO...etc all acceptable entries) Enter the author, title and the isbn of the book separated by /: Ericka Jones/Java made Easy/458792132 Got it! Now, tell me if it is a bookstore book or a library book (enter BB for bookstore book or LB for library book): BSB (Lb, bB...etc all acceptable entries) Oops! That's not a valid entry. Please try again: Bookstore Oops! That's not a valid entry. Please try again: bB Got it! Enter the list price of JAVA MADE EASY by ERICKA JONES: 14.99 Is it on sale? (yes/no): yes (yEs, Yes,..., No, NO,nO...etc all acceptable entries) Deduction percentage: 15% (Enter this as a percentage) Got it! Here is your bookstore book information [458792132-JAVA MADE EASY by ERICKA JONES- $14.99 listed for $12.74] (this output is what the toString() returns) If Java Made Easy wasn't on sale, your code should print: [458792132-JAVA MADE EASY by ERICKA JONES, $14.99] Would you like to create a book object? (yes/no): yeah Oops! That's not a valid entry. Please try again: yes Enter the author, title and the isbn of the book separated by /: Eryc Jones/Java as a healing language/95879213m Got it! Now, tell me if it is a bookstore book or a library book (enter BB for bookstore book or LB for library book): LB
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
JAVA ONLY PLEASE!!
PLEASE WRITE THE CODE WITH USER ERROR AND ALL ACCEPTABLE ENTRIES!!!
PLEASE USE CODE THAT WILL RUN IN ECLIPSE!
THIS IS MY 3RD TIME ASKING BECAUSE NO ONE IS FOLLOWING THE INSTRUCTIONS CORRECTLY.
DON'T COPY THE CODE THAT HAS ALREADY BEEN USED ON THIS QUESTION BECAUSE IT IS NOT CORRECT!!!
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 6 steps with 2 images
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Please help with the rest of the subparts of the code!
The first three were very good!
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education