Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the contents in the images if it is not visible- package bookStore; /** * A class representing a book store that has an

image text in transcribedimage text in transcribed

image text in transcribed

image text in transcribed

This is the contents in the images if it is not visible-

package bookStore;

/** * A class representing a book store that has an * owner . A book store owns a collection (or possibly * collections) of books, but does not own the books themselves * . * *

* Only the owner of the book store is able to sell books from the book store. * The book store does NOT own its owner . *

*/

import java.util.*; public class BookStore { /* * YOU NEED A FIELD HERE TO HOLD THE Book OF THIS BookStore */

private TreeMap books; private BookStoreOwner owner;

/** * Initializes this book store so that it has the specified owner and no * books. * * @param owner the owner of this book store */ public BookStore(BookStoreOwner owner) { // COMPLETE THIS

}

/** * Initializes this book store by copying another book store. This book store will * have the same owner and the same number and type of books as the other * book store. * * @param other the book store to copy */ public BookStore(BookStore other) { // COMPLETE THIS

}

/** * Returns the owner of this book store. * *

* This method is present only for testing purposes. Returning the owner of this * book store allows any user to sell books from the book store (because any * user can become the owner of this book store)! * * @return the owner of this book store */ public BookStoreOwner getOwner() { // ALREADY IMPLEMENTED; DO NOT MODIFY return this.owner; }

/** * Allows the current owner of this book store to give this book store to a new * owner. * * @param currentOwner the current owner of this book store * @param newOwner the new owner of this book store * @throws IllegalArgumentException if currentOwner reference is not the reference of the * current owner of this book store */ public void changeOwner(BookStoreOwner currentOwner, BookStoreOwner newOwner) {

// COMPLETE THIS

}

/** * Adds the specified books to this book store. * * @param books a list of books to add to this book store */ public void add(List books) { // COMPLETE THIS

}

/** * Returns true if this book store contains the specified book, and false * otherwise. * * @param book a book * @return true if this book store contains the specified book, and false * otherwise */ public boolean contains(Book book) {

// COMPLETE THIS

}

/** * Allows the owner of this book store to sell a single book equal to the * specified book from this book store. * *

* If the specified user is not equal to the owner of this book store, then the * book is not sold from this book store, and null is returned. * * @param user the person trying to sell the book * @param book a book * @return a book equal to the specified book from this book store, or null * if user is not the owner of this book store @pre. the book store * contains a book equal to the specified book */ public Book sellingsingleBook(BookStoreOwner user, Book book) {

// COMPLETE THIS

}

/** * Allows the owner of this book store to sell the smallest number of books * whose total price value in dollars is equal or less than to the specified * price value in dollars. Try from the most expensive book and you may want * to use descendingKeySet() method. * *

* Returns the empty list if the specified user is not equal to the owner of * this book store. *

* * @param user the person trying to sell books from this book store * @param pricevalue a value in dollars * @return the smallest number of books whose total price value in dollars is * equal to the specified value in dollars from this book store @pre. the * book store contains a group of books whose total price value is * equal to specified value */ public List sellingBooks(BookStoreOwner user, int pricevalue) {

// COMPLETE THIS

} }

LAB EXERCISE Complete the implementations of various classes in a bookStore. Read the API for bookStore carefully, the API of this lab is available under doc folder in the Java project folder (doc-index.html). Some example tests are given to you in the Testerv3 class. We consider a database that stores information about books and owners. Each book has (e.g., String title, int price, int yearPublished), whereas BookStoreOwner has (String name and long id). You must implement all methods in the BookStore. For this question, you are required to submit Java files such as Book, BookStore, BookStore Owner, SortBooksby Year in your Eclipse project. eclipse-workspace - EE SUO LABIW20_stud/s/boo Shore BookStore V8 - Eclipse IDE File Edit Source Relector Navigate Search Project Run Window Help Quick Access o book store that has an - YOU NEE D HER TO HOLD THE Tek or HS Tank Store > private Treepok, Tatever boks; private Tonkatarebumer owner; buire > Book, ava > BankStorej > T BookStorcowner, ava > Sorteoksby Year.js > Texturvajave Toitializes this book store so that it has the specified owner and no par uner the owner of this book store puble BookstoreBookStorer wer) { > > > I > > Flightinnjava Fight Managersystemjava Alreadystocephoin.js ndespion.java Passengerinto, ava Teeser. V - Taitializes this book store by copying another bank store. This book store will have the case owner and the came number and type of books as the other Outline 2 =D > > > dor FEC52000 Lab4 Hello world Pure OOP - parather the bank store to copy public Doktor (hoekStore other COMPLETE THTS Return the ner of the back tore. bookstore Bolhere . bucks: TrueMap Owner: BookStor Bankrinks BookStorcBooks getowner): changes addiList EECS2050_LABUN20 student IS2000 Laht EECS2080_L4B1W20 student IS2000 LADO TEC52080 LABYWudumi EECS2050_Lab3 FFCS LARWA chud JRE Sytem Library VSE 18 ar currenter the current one of his sont store porn newer the new owner of this book store throus Tiles Argument cestion 1+ current Owner reference is not the reference of the Crent owner of the back store Find All Act > public void changeuner(Bonk Streuner current owner, Bookstore wwer newer) { > // COMPLETE THTS buire > Book, ava > BankStorej > T BookStorcowner, ava > Sorteoksby Year.js > Texturvajave Ads the specified books to this book store para hooks a list of booke to add to the hook store public void addstock > hanks! COMPLETE THTS > > > I > > Flightinnjava Fight Managersystemjava Alreadystocephoin.js ndespion.java Passengerinto, ava Teeser. V Outline 2 =D > Returns true if this book store contine cifted hook, and false > > dor FEC52000 Lab4 Hello world Pure OOP para hack hook return true if this honk store contain the cifted book, and falo public boolean contains ook book) { // COMPLETE THIS bookstore Bookstore . buck: TrueMap Owner: BookStor Bankrinks BookStorcBooks getowner): changes addiList EECS2050_LABUN20 student IS2000 Laht EECS2080_L4B1W20 student IS2000 LADO TEC52080 LABYW d um EECS2050_Lab3 FFCS LARWA chud JRE Sytem Library VSE 18 All the war of this book store tu ulla ini bukwuel to the cified buck free this busk atere. Find All Act > > . If the specified user is not w el to the cheruf this back turs, then the book is not sold from this book atare, and null is returned. buire > Book, ava > BankStorej > T BookStorcowner, ava > Sorteoksby Year.js > Texturvajave @pura uur the pure tryin to the book @pura back returnbuck wual to the pulled ou frun this book tur, or mull if uur is not the owner of this back atur . the buck store contains boek wuel to the specified back public Beukellingsingk ruuksturwr war, Bock bcuk) { COMPLETE THIS 123 > > > > > Flightinnjava Fight Manager System java Alreadystocephoin.js Nun cuprion.java Passengerinto, ava Ter. V All the war of this book store tu ull the wallstubur of books who tutal price value in dollars is wual ur lua than to the specific price value in dollar. Try from the most pensive back and you may want to use duce dinget() muthad. Outline 2 =D > > > dor FEC52000 Lab4 Hello world Pure OOP Huturns the wply list it this book store lied wer is not wal tu theam of is the @pura uur the person trying to wll book frun this bokatur @pura pricavalu awal is dullar return the smallest number of bouka wa tutal price value in dollar qual to the specifind value in dollars from this book store bukature contin grup of books w tulel in value is wal tu specified water public Listuuko wlling Backa (duukStarther user, int priceval) ( COMPLETE THIS bookstore Bolhere . buck: TrueMap Owner: BookStor Bankrinks BookStorcBooks getOwner: Boo change : addiList book store that has an - YOU NEE D HER TO HOLD THE Tek or HS Tank Store > private Treepok, Tatever boks; private Tonkatarebumer owner; buire > Book, ava > BankStorej > T BookStorcowner, ava > Sorteoksby Year.js > Texturvajave Toitializes this book store so that it has the specified owner and no par uner the owner of this book store puble BookstoreBookStorer wer) { > > > I > > Flightinnjava Fight Managersystemjava Alreadystocephoin.js ndespion.java Passengerinto, ava Teeser. V - Taitializes this book store by copying another bank store. This book store will have the case owner and the came number and type of books as the other Outline 2 =D > > > dor FEC52000 Lab4 Hello world Pure OOP - parather the bank store to copy public Doktor (hoekStore other COMPLETE THTS Return the ner of the back tore. bookstore Bolhere . bucks: TrueMap Owner: BookStor Bankrinks BookStorcBooks getowner): changes addiList EECS2050_LABUN20 student IS2000 Laht EECS2080_L4B1W20 student IS2000 LADO TEC52080 LABYWudumi EECS2050_Lab3 FFCS LARWA chud JRE Sytem Library VSE 18 ar currenter the current one of his sont store porn newer the new owner of this book store throus Tiles Argument cestion 1+ current Owner reference is not the reference of the Crent owner of the back store Find All Act > public void changeuner(Bonk Streuner current owner, Bookstore wwer newer) { > // COMPLETE THTS buire > Book, ava > BankStorej > T BookStorcowner, ava > Sorteoksby Year.js > Texturvajave Ads the specified books to this book store para hooks a list of booke to add to the hook store public void addstock > hanks! COMPLETE THTS > > > I > > Flightinnjava Fight Managersystemjava Alreadystocephoin.js ndespion.java Passengerinto, ava Teeser. V Outline 2 =D > Returns true if this book store contine cifted hook, and false > > dor FEC52000 Lab4 Hello world Pure OOP para hack hook return true if this honk store contain the cifted book, and falo public boolean contains ook book) { // COMPLETE THIS bookstore Bookstore . buck: TrueMap Owner: BookStor Bankrinks BookStorcBooks getowner): changes addiList EECS2050_LABUN20 student IS2000 Laht EECS2080_L4B1W20 student IS2000 LADO TEC52080 LABYW d um EECS2050_Lab3 FFCS LARWA chud JRE Sytem Library VSE 18 All the war of this book store tu ulla ini bukwuel to the cified buck free this busk atere. Find All Act > > . If the specified user is not w el to the cheruf this back turs, then the book is not sold from this book atare, and null is returned. buire > Book, ava > BankStorej > T BookStorcowner, ava > Sorteoksby Year.js > Texturvajave @pura uur the pure tryin to the book @pura back returnbuck wual to the pulled ou frun this book tur, or mull if uur is not the owner of this back atur . the buck store contains boek wuel to the specified back public Beukellingsingk ruuksturwr war, Bock bcuk) { COMPLETE THIS 123 > > > > > Flightinnjava Fight Manager System java Alreadystocephoin.js Nun cuprion.java Passengerinto, ava Ter. V All the war of this book store tu ull the wallstubur of books who tutal price value in dollars is wual ur lua than to the specific price value in dollar. Try from the most pensive back and you may want to use duce dinget() muthad. Outline 2 =D > > > dor FEC52000 Lab4 Hello world Pure OOP Huturns the wply list it this book store lied wer is not wal tu theam of is the @pura uur the person trying to wll book frun this bokatur @pura pricavalu awal is dullar return the smallest number of bouka wa tutal price value in dollar qual to the specifind value in dollars from this book store bukature contin grup of books w tulel in value is wal tu specified water public Listuuko wlling Backa (duukStarther user, int priceval) ( COMPLETE THIS bookstore Bolhere . buck: TrueMap Owner: BookStor Bankrinks BookStorcBooks getOwner: Boo change : addiList

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_2

Step: 3

blur-text-image_3

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

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

5.3 Explain internal recruitment methods.

Answered: 1 week ago