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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started