How would I create this code in Java? The coding prompt is attached below. SAMPLE RUN BELOW (user entry in bold) Make sure that for the search feature it can search between author, title, or isbn depending on what the user enters. 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 What’s the subject: Medicine (MeDiciNE, MEDICINE.... are acceptable entries . See list of subjects at the end of this document.) Got it! Here is your library book information [958792130-JAVA AS A HEALING LANGUAGE by ERYC JONES-R.09.ERI.M] Would you like to create a book object? (yes/no): yes Enter the author, title and the isbn of the book separated by /: Erica Jone/The Art of Java /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 What’s the subject: Fine art Oops! That’s not a valid entry. Please try again: Fine arts Got it! Here is your library book information [958792139-THE ART OF JAVA by ERICA JONE-N.01.ERI.9] Would you like to create a book object? (yes/no): no Sure! Here are all the books you entered... Library Books (2) [958792130-JAVA AS A HEALING LANGUAGE by ERYC JONES-R.09.ERI.M] [958792139-THE ART OF JAVA by ERICA JONE-N.01.ERI.9] _ _ _ _ Bookstore Books (1) [458792132-JAVA MADE EASY by ERYCKA JONES, $14.99 listed for $12.74] _ _ _ _ Would like to search for a book? (yes/no): yes Search by isbn, author or title? Author (IsbN, aUthor, tiTle ...etc are acceptable entries. Here assume that the user keys in correct entries) Enter the first three letters of the author: Eri We found 1 Library Book (s) and 1 Book Store Book(s): [458792132-JAVA MADE EASY by ERYCKA JONES, $14.99 listed for $12.74] [958792139-THE ART OF JAVA by ERICA JONE-N.01.ERI.9]
How would I create this code in Java? The coding prompt is attached below.
SAMPLE RUN BELOW (user entry in bold)
Make sure that for the search feature it can search between author, title, or isbn depending on what the user enters.
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
What’s the subject: Medicine (MeDiciNE, MEDICINE.... are acceptable entries . See list of subjects at the end of this document.)
Got it!
Here is your library book information
[958792130-JAVA AS A HEALING LANGUAGE by ERYC JONES-R.09.ERI.M]
Would you like to create a book object? (yes/no): yes
Enter the author, title and the isbn of the book separated by /: Erica Jone/The Art of Java /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
What’s the subject: Fine art
Oops! That’s not a valid entry. Please try again: Fine arts
Got it!
Here is your library book information
[958792139-THE ART OF JAVA by ERICA JONE-N.01.ERI.9]
Would you like to create a book object? (yes/no): no
Sure!
Here are all the books you entered...
Library Books (2)
[958792130-JAVA AS A HEALING LANGUAGE by ERYC JONES-R.09.ERI.M]
[958792139-THE ART OF JAVA by ERICA JONE-N.01.ERI.9]
_ _ _ _
Bookstore Books (1)
[458792132-JAVA MADE EASY by ERYCKA JONES, $14.99 listed for $12.74]
_ _ _ _
Would like to search for a book? (yes/no): yes
Search by isbn, author or title? Author (IsbN, aUthor, tiTle ...etc are acceptable entries. Here assume that the user keys in correct entries)
Enter the first three letters of the author: Eri
We found 1 Library Book (s) and 1 Book Store Book(s):
[458792132-JAVA MADE EASY by ERYCKA JONES, $14.99 listed for $12.74]
[958792139-THE ART OF JAVA by ERICA JONE-N.01.ERI.9]
Trending now
This is a popular solution!
Step by step
Solved in 6 steps with 9 images