Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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: image text in transcribed
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

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

Step: 3

blur-text-image

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

What online recruitment methods are available?

Answered: 1 week ago