HW 3: This HW is a continuation of HW2 - The goal of this coding exercise is to create two classes BookstoreBook and Lib

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

HW 3: This HW is a continuation of HW2 - The goal of this coding exercise is to create two classes BookstoreBook and Lib

Post by answerhappygod »

Hw 3 This Hw Is A Continuation Of Hw2 The Goal Of This Coding Exercise Is To Create Two Classes Bookstorebook And Lib 1
Hw 3 This Hw Is A Continuation Of Hw2 The Goal Of This Coding Exercise Is To Create Two Classes Bookstorebook And Lib 1 (70.82 KiB) Viewed 56 times
Hw 3 This Hw Is A Continuation Of Hw2 The Goal Of This Coding Exercise Is To Create Two Classes Bookstorebook And Lib 2
Hw 3 This Hw Is A Continuation Of Hw2 The Goal Of This Coding Exercise Is To Create Two Classes Bookstorebook And Lib 2 (43.12 KiB) Viewed 56 times
HW 3: This HW is a continuation of HW2 - The goal of this coding exercise is to create two classes BookstoreBook and LibraryBook that both inherit from the abstract class Book. The class Book have these attributes: author: String tiltle: String isbn : String - 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 20% off...etc). For a LibraryBook, we add the call number (that tells you where the book is in the library) as a string. The call number is automatically generated by the following procedure: The call number is a string with the format xx.yyy.c, where xx is the floor number that is randomly assigned (our library has 99 floors), 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. - In each of the three classes, 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 by using super.toString(). - Your code should handle up to 100 books. For this, your code must use one array (of type Book) in which you store both types of books. - Your code should display the list of all books keyed in by the user
Welcome to the book program! Would you like to create a book object? (yes/no): yes Please enter the author, title ad 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): BLB Oops! That's not a valid entry. Please try again: Bookstore Oops! That's not a valid entry. Please try again: bB Got it! Sample Run The user's entry is marked in boldface Please enter the list price of JAVA MADE EASY by ERICKA JONES: 14.99 Is it on sale? (y/n): y Deduction percentage: 15% Got it! Here is your bookstore book information [458792132-JAVA MADE EASY by ERICKA JONES, $14.99 listed for $12.74] Would you like to create a book object? (yes/no): yeah I'm sorry but yeah isn't a valid answer. Please enter either yes or no: yes Please enter the author, title and the isbn of the book separated by /: Eric Jones/Java made Difficult/958792130 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 Got it! Here is your library book information [958792130-JAVA MADE DIFFICULT by ERIC JONES-09.ERL0] Would you like to create a book object? (yes/no): yes Please enter the author, title and the isbn of the book separated by / Erica Jone/Java made too Difficult/958792139 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 Got it! Here is your library book information [958792139-JAVA MADE TOO DIFFICULT by ERICA JONE-86.ERI.9] Would you like to create a book object? (yes/no): no Sure! Here are all your books... Library Books (2) [958792130-JAVA MADE DIFFICULT by ERIC JONES-09.ERI.0] [958792139-JAVA MADE TOO DIFFICULT by ERICA JONE-86.ERL.9] Bookstore Books (1) [458792132-JAVA MADE EASY by ERICKA JONES, $14.99 listed for $12.74] Take care now!
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply