Question: In java create a function called readBooks (filename) that takes as input the books.txt and adds books to a data structure. It does not need

In java create a function called readBooks (filename) that takes as input the books.txt and adds books to a data structure. It does not need to return anything.

create a function called readOrders (filename) that takes as input the orders.txt and adds orders to a data structure. It does not need to return anything.

create a function called addOrder (custID, bookID) that takes as input the customer ID and book ID then adds a new order (remember to decrement the available quantity in stock for that purchased book). It returns true if the order was successful and false otherwise.

create a function called deleteOrder (custID, bookID) that takes as input the customer ID and book ID then removes the order that the customer has made for this book ID. It returns true if the removal was successful and false otherwise.

create a function called getQuantity (bookID) that takes as input the book ID and returns the stock available for that book.

All of the above functions must run in time that is better than O(n) worst-case time, where n is the number of books/customers.

Compare your running time of getQuantity() to another function getQuantityFromArray() where books are stored in a simple array instead of the data structure that you initially chose.

You should create a function called custFavorite(custID) that takes as input the customer ID and returns that customer's most purchased book.

The above function must run in time that is better than O(n) worst-case time, where n is the number of customers.

output:  In java create a function called readBooks (filename) that takes as

Enter book: f Llenane >bocka, tret Docka added (ranning time: 13.2na ) Enter cuatceer arders f1lease: >) ordera, txt arderz added (runalng tiee: 84.5ma ) 4 Computer Enginering Department Cellege of Engineering and Petpuleum Kurwait Univeraity Choole sext operation (enter -1 to exis) 1. Insert new custoner order 2. belete order 3. Get book quantity 4. Find custoser" n faworite book 1 Enter cuatoeer ID and book ID purchased: >3 3,44 Cuatoner ID 3 han purchased Book I0 44 (running tine: 2.1mn ) Choose next operation (enter -1 to exit): 1. Inaert nes custocer order 2. Delete order 3. Get book quantity 4. Find cuatoser's favorite book. 3) 2 Enter curtomer ID and book. ID: >3,44 Choove next operation (enter -1 to exit) : 1. Insert seu customer order 2. Delete order 3. Get book quantity 4. Find cuatoeef'a faworite beok. 3 Enter book 10: 3) 71 Book ID 71 has 4 copiea left (runsing tise: 3 as) Choose next operation (enter -1 to exit) : 1. Tnaert ser custener arter 2. Delete order 3. Get book quantity 4. Find custoner's favorite book. is 4 Enter cuntoaer ID: >) 8 Cuatoser to B eost purchased book is Book ID 61 (purchased a tises? (runing tine: 4.2ms)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!