CMSC 202 Project 3
The F & R
Memorial Library
Assigned |
Mon Mar 22 |
Project Due | 10:00 AM, Mon Apr 5 |
Weight |
8% |
Objectives
- To gain experience designing, coding, and testing classes
including accessors, mutators, constructors, constants,
and proper declaration of public/private methods and data.
- To gain experience with the use of composition in an OO design.
- To gain experience programming with partially filled arrays.
- To become familiar with standard Java documentation.
Project Description
This project will simulate a simple library. The library will consist of
a set of books and set of patrons (people who borrow and return books).
The library keeps each book's title and author. Books are uniquely identified by their title.
The library keeps each patron's first and last name and assigns each patron a unique library card number.
Patron's are uniquely identified by their name and their card number. Library card numbers start
at 1001. Your library will support the following functionality. More details may be found in
the Javadoc for the Library.
- Add a book to the library
- Add a patron to the library
- Check out a book to a patron
- Return (check in) a book
- List all books in the library
- List all patrons of the library
- Display the information for a particular book
- Display the information about a particular patron
This project will use a GUI to allow the user to select the function s/he wishes to perform.
The GUI and the main driver will be provided for you in Project3.java
to be found in Mr. Bergeron's public directory for this project. The GUI provides the required
data input error checking. Your job is to design and implement
a class for the Library and other necessary classes. Since only the
Library class is used directly by main
in Project3.java, you are free to design and implement the other classes as you see fit. A significant part of
the project grade will rely on how well you design and implement the Library and these other classes.
Project Policy
This project is considered an CLOSED project. This means
- You should try as much as possible to complete the project by yourself.
- You may get assistance only from the TAs or instructors
- You must document all outside help you get as part of your file header comment.
As usual, you MAY NOT
- copy anyone else's code
- have someone else write your code for you
- submit someone else's code as your own
- look at someone else's code
- have someone else's code in your possession at any time
Such offenses are violations of the student code of academic conduct.
Project Specification
The Library Class
The required Libarary class should have capacity to hold up to 1000 different book titles
and up to 50 different patrons.
The library class provides public methods to support the functionality listed above in the
project description. This Javadoc description
lists the public methods and constants that the library must support and provides many details of the
Library methods. You are free to write any private helper methods you deem necessary.
Other Classes
It should be clear from the project description that classes are necessary for a book
and for a patron. Think about what "thing" each class represents, what instance variables are
needed to represent the "thing's" state, and what operations the
"thing" must provide for the Library. Do all of this before writing even one line of code.
You must implement code in main
for each class to test that class' functionality.
Requirements, Hints, and Tips
- Mr. Bergeron's public directory for this project is
/afs/umbc.edu/users/r/b/rberge1/pub/202
- In the event that there is a discrepancy between the Javadoc and this description,
this description should be considered correct.
- Recall that each class must be implemented in a separate .java file.
- Each file for this project should be part a package named
proj3
.
- See Testing Your Class in Main for help writing
main
to test your classes.
- Classes represent a single "thing". with as little knowledge of the
"outside world" as possible.
- The mechanism for determining which books are checked out to a particular patron can be implemented
in a variety of ways. Try to design a way that does not waste space or is overly inefficient.
- There is no limit to the number of books a patron may check out
- Your Library must detect and report the following logical errors. As noted in the
Javadoc, Library methods typically return a String. That String should indicate that the requested operation succeeded or contain an error message indicating
specifically why it failed. Be sure to consider all ways in which a library operation
may fail. Error message should include the book title and/or patron name as appropriate. (e. g. if a book
could not be added to the library, the error message should include the title of the book that
could not be added.)
- Failure to add a book title.
- Failure to add a patron.
- Failure to check out a book
- Failure to return a book
- Failure to display information about a patron
- Failure to display information about a book
- All book titles and patron names are case sensitive.
- Authors may have only a first name or only a last name
- Patrons must have both a first and last name. This is enforced by the GUI
- All names (patron's and author's) must be displayed last name first
if there is both a first and last name. Otherwise, just display the part of the name that exists.
- Project3.java requires that you define a constant in the Libraray
class named
MAX_COPIES
. This constant is used by the GUI for error checking.
Extra Credit is available if your Library supports multiple copies of the
same book. If do not implement the extra credit, define MAX_COPIES = 1 and forget about it.
For 10 points of extra credit, your library should allow for multiple
copies of the same book title (e.g. MAX_COPIES = 5). Each copy may be checked
out to a different patron. A patron may check out multiple copies of the same book.
The String returned from the library operations "display information about a book", "check out a book", and "return a book" should indicate the number of copies, how many are checked out (and to whom) and how many are available for check out. The "list of all books" should include the number of copies of each book.
pwd
Note that even if multiple copies of a book are added to the library, the number of book titles
in the library is still incremented by one. The library holds 1000 different book titles, even if
each book has multiple copies.
Grading
The grade for this project will be broken down as follows. A more detailed
breakdown will be provided in the grade form you receive with your project grade.
Correctness
This list may not be comprehensive, but everything on this list will be
verified by the graders.
- Your project produces all required output.
- The output produced is correct.
- The output is in an acceptable format.
- Your project detects and reports all required errors
- The design and implementation of all classes follows appropriate OO principles
related to encapsulation and data hiding.
Coding Standards
Your code adheres to the
CMSC 202 coding standards as discussed
and reviewed in class.
In particular, pay particular attention to the list below. Graders will check all applicable
items in the coding standards.
- Your class comments (particularly class invariant)
- Your method header comments (particularly pre- and post-conditions)
- Method and variable names
- In-line comments
- Code readability
- Limiting variable scope
- Class method names
- Class instance variable names
Project Submission
- submit Library.java
and your other .java files.
- submitls to verify they are in the remote directory
- DO NOT submit Project3.java
The order in which the files are listed doesn't matter. However, you must make
sure that all files necessary to compile and run your project are submitted.
You need not submit all files at the same time. You may resubmit
your files as often as you like, but only the last submittal will be graded and
will be used to determine if your project is late. For more information,
see the projects page on the course website.
You can check to see what files you have submitted by typing
submitls cs202s10 Proj3
More complete documentation for submit and related commands can be found
here.
Remember -- if you make any change to your program, no matter how
insignificant it may seem, you should recompile and retest your program before
submitting it. Even the smallest typo can cause compiler errors and a reduction
in your grade.
Avoid unpleasant surprises!