[CLIS logo]

LBSC 790/INFM 718B
Building the Human - Computer Interface
Fall 2004
Homework Assignment 1

*** REVISED SEP 14 at 12:30 AM *** This exercise should take about 2 hours to complete, but unlike the self-graded assignments you will need to keep at it until you get it right because this one is being graded! Moreover, my 3-hour estimate assumes that you are caught up on your reading and that you have successfully completed the first two self-graded exercises. If you have not done any of those things yet, this will probably take you about 18 hours since you need to do those things first!

In this exercise, you will extend the Java program that we developed in class for the Library to accommodate multiple copies of each book. Start by downloading the java files containing the Book and Library class files that we developed in class from the same page that you normally get the notes from (here).

Next, modify the Book class, but DO NOT modify the Library class! Your goal is to implement the new capability without making any changes at all to the Library class. Start by changing the boolean variable called "available" to an int that represents the number of available copies. Next, modify the Book constructor to represent the presence of two copies of each book that is created. Next, modify the checkIn, checkOut, and getAvailable classes to check and/or update the available variable appropriately. Note that the getAvailable method must still return a boolean, since we want NO CHANGES AT ALL to the Library class. You may change the main method in the in the Book class to see if everything is working okay if you like.

Then run the main method in the Library class (NOT the Book Class). If it prints "Darn, it's still available!", then your program is operating correctly. If not, go back and look again at the Book class to figure out what you did wrong. If you find problems that you can't fix, attend the lab session to seek help from the TA, or send one of us an email with enough details so that we can help. Plan ahead: because of overseas travel, I may not be on email much more than once a day in the next week, and I may not be on at all on Sunday!

Finally, export your revised Book.java file and email it as an attachment to both the TA and me (to ensure that one of us gets it). Email submitted after the deadline (Monday at 5:30) will not be graded (since the solutions will be posted), so it is a sure thing that you would be better off to send something on time rather than to sending nothing in the hopes that you might have something better later. And you would be MUCH better off to attend class on Monday than to skip it so that you can work more on your homework (since you would get a zero on the homework AND miss the class - a really bad deal). Anyhow, you won't know how generous we will be with partial credit until you try! Be sure to read the instructions about working together on homework on the course description Web page if you have any questions about what sort of collaboration is allowed.

Doug Oard
Last modified: Fri Aug 20 22:06:06 2004