Enterprise Systems Programming
Lab 1: Java
Create a set of Java programs for a simple library application.
You will need to create three classes, and two of these classes
have already been written for you.
(You will need to write the Book class from scratch).
- LibTester.java ( contents ):
this is a tester program that creates Book and Borrower objects
and tests borrowing and returning of books.
- Borrower.java ( contents ):
A borrower has an id and a name and stores a list of books
currently borrowed. Check the class and the tester for methods
supported by this class.
- Book.java:
A book stores a catalog number, title, author, and
a reference to the current borrower. Check the Borrower class
and the tester for methods you need to support.
Important: Borrower and Book should be part of a package called
library . You should store all your programs
inside a folder named Lab1.
Lab1 should contain LibTester.java, LibTester.class and a folder
called library.
The library folder should contain Borrower.java, Book.java,
and their corresponding .class files.
You are done with this lab when you execute LibTester
and the following output results.
When you are done, zip the Lab1 folder and name the archive
[idnumber]-Lab1.zip or [idnumber]-Lab1.rar.
Submit this archive through
moodle .
You may work in pairs, but each pair must make a submission.
If working in pairs, make sure you place both names
of the members in the Book.java file.
Tips:
- When a book object has no current borrower,
set the value of the borrower reference to null,
meaning it is not refering to an object.
- The keyword this is a reserved word in Java
which means "the current object for that class".
Look at the borrowBook method of Borrower for a
sample use of this. You will need to use the
this keyword in the returnBook method of Book.
- The Book class, when completed, should be less than
50 lines of code. Each method in this class will contain
less than 5 lines.