Using the
code provided for the Bookstore application, modify it to do the following:
- Use a URL connection object to make an http "get" to the site:
http://komar.cs.stthomas.edu/servlet/InStock. You will need to append to that URL a string
consisting of ?isbn= followed by the ISBN number of a book.What will be returned is a number --
a -10 if the isbn number is not found, a -1 if the isbn number was found but there
are no books in stock, or a positive number indicating how many books with that isbn
there are in stock after one is subtracted for your order. The servlet InStock will
automatically reduce the inventory by one book.
- Change the Book class getQuantity() method so it uses the URL object above to make the query
and return the value to the user interface.
- Change the user interface where it calls the getQuantity() method and the
reduceQuantity() method to reflect this new procedure.