CS161 Assignment 6: Managing a library's catalog



The objective of this assignment is to give you practice in using inheritance in Java

In this assignment you will write a collection of classes that manage a library. The library has a collection of items, and for simplicity we will assume this library only has books and DVDs. We will model the items in the library using three classes: an Item class that collects information and behavior that is common to both types of items (id, title, and number of copies available). You will also have Book and DVD classes that extend the basic Item class, where a book contains the name of the author, and number of pages, and a DVD will have a playing time in minutes. The items in the library will be stored in a class called Catalog which will also allow patrons to search and borrow items. Patrons are divided into two groups according to age: Youth and Adult. The difference between an adult and youth is in their quota, i.e. the number of items they are allowed to borrow (2 for Youth, 3 for Adult). The following diagram summarizes the relationships between the classes:
               Item             Patron               Catalog
              /    \           /      \
	    DVD    Book      Youth    Adult
Here are the details for the methods that each class needs to implement (note that in this assignment we are not modeling due dates):
The Item class:
The item class stores the following information: The Book class (extends Item) stores information that is specific to a book: The DVD class also extends Item and stores DVD-specific information: The base class for library patrons is called Patron and has the following methods and data: Your Patron class should have two subclasses: Adult and Youth whose quotas are 3 and 2, respectively.
The final class you need to implement represents the library's catalog. This class, called Catalog, should have the following data and methods: To help you in writing your code, here is some code for exercising your classes.

Submission:
Your classes should be stored in three Java files: Item.java, Patron.java, and Catalog.java that need to be submitted as a single tar file called pa6.tar and submitted via checkin as PA6. Put the Youth and Adult classes in the file Patron.java, and Book and DVD in Item.java.
Update: you can also write your code such that each class is in its own file.
To create the tar file proceed as follows:
## Create a directory called PA6 using the command
mkdir PA6
Copy the .java files into that directory and then run the following command to create the tar file:
tar -cvf pa6.tar PA6
Now you are ready to submit pa6.tar using checkin.
Note that your code should compile on department Linux machines, and make sure that you are submitting the source code rather than the Java class file.