Java 1 -- Student Project

Thierry Coulbois

Al-Quds University -- 1st Semester 2002-2003





Preliminaries

A Java Course Project should be a Java program (a set of classes) that can be executed properly.

However executability is only one of the aspect of appreciation of a Program. Other very important criteria of appreciation are: Design, Readability, Evolution, Documentation.

Design: Java is an Object Oriented Programming language and your program should be object oriented.

Readability: Your code should be clear and readable. The names used should be informative. it should include a lot of comments. Be sure that you will provide all the source files.

Evolution: Your code should be able to evolve in the future to add new features to your classes.

Documentation: Provide a JavaDoc style documentation, which should be complete, readable and informative.





Evaluation

The Java projects will be 30% of the mark of this course. You have to work by groups of three students. The above criteria will be applied to the evaluation. You will be ask to make a short presentation (10 min) of your project. The quality of the presentation will also be taken into account.

Here is a list of items that will be considered.

  1. Are the student familiar with the development environment, and do they prepare quickly and efficiently their demonstrations?
  2. Does the program work?
  3. Quality of the user interface
  4. Did they test their program? How?
  5. Do they clearly explain the design of their project?
  6. How did they plan and share the project?
  7. Is the design of the project object oriented?
  8. Is the code clear?
  9. What are the possible future evolution of the project?
  10. How is the documentation?





Project

We want to write a program for the university library. The library maintains two databases: one for the books and one for the users. Books have a title, an author and a publication year. Books can be either in the library or borrowed by a user. Users can be either students or professors. Students have a name and a student number. Professors have a name and belongs to a faculty. Users can borrow books. A Student can borrow 2 books at a time while professors are allowed to borrow 5 books simultaneously.

The program can read and store its two databases in a file.

There is a user interface that allows to add new books and new users to the library. It also allows to store the two databases in a file. The user interface proposes to borrow or to return books. It displays each time it is useful the list of books and of users.

Some implementation details

A Library contains two fields that are arrays one for the books and one for the users. The size of the arrays is set by two constants MAX_BOOK_NUMBER and MAX_USER_NUMBER. The Library class provides methods that read or write a Library from a file. It contains methods addBook and addUser to add new books and new users. It contains methods to display the list of books and the list of users. The Library class has a method to borrow a book and a method to return a book.

A Book has a borrower field to record who borrowed it (possibly nobody). The Book class provides a method to prompt the user for entering a new book.

A User has a field int borrowedBooks to record the number of books it has borrowed. The class provides a constant MAX_BORROWED_BOOKS that indicates how many books a user is allowed to borrow at the library. Each time a user wants to borrow a book the class checks that he is allowed to do so and increments its borrowedBooks. Conversely when a book is returned the borrower has his borrowedBooks decremented.

A user can be a student or a professor. Provide a method to prompt the user for new students or professors.

Write a main method that will run your classes, load the library from a file and propose different options to the user: adding new books or users, borrowing or returning a book, listing the available books, the borrowed books and the users, saving the library.

Test your program. Provide a file where there is a library with around 10 books and 6 users.




Project organisation

First try to understand the general purpose of the project and to design an architecture for your program: what are the classes, what are the methods, what are the fields. Then share the work between your team and begin to write some code. At each step of the development write some extra-code to test your project (main methods, toString methods, test files, etc.). Discuss regularly together for a good understanding of the project. Come and show your preliminary versions to Dr Thierry or to Mohammad. Discuss with other groups.

In the project you need sub-classes and File and Stream classes that we did not yet study. Wait a little for that.

You can already write the Book, Student and Library classes (or at least part of them). Try to write a calendar for your project. E.g. by the end of december, all methods not using Files and Streams should be writen and in the first week of January you should begin to write the user-interface.