Project 1

College Information System (CIS)

Problem

This is your first attempt to developing a useful software system that can help a college manage essential information about students, professors, courses, and more. For this development phase, you are asked to build a simple dialog-based GUI to allow users (either students or professors) to login to the system. Your system should allow a student to view professors from whom s/he takes class from, or a professor to view class rosters. Since a class may have a good number of students in it, the professor may want to list students in various orders (such as before name or by major). Your system will need to support this purpose.

Requirements & Analysis

In this phase, it’s assumed that a professor teaches just one class, while a student may take more than one class. Information about students and professors, and enrolment are stored in separate files (namely, student.data, professor.data, enrollment.data), which are available under the Project1Data folder.

Your program needs to read the data when it starts up, and manage them in three lists (or arrays if you prefer). For student and professor information, you can use a generic User class to capture the data, since both share the same attributes, namely id, firstName, lastName, and programCode (such as CSC, IST, MAT, etc). An Enrollment class can be used to capture enrollment information, which includes a studentId, a courseCode(such as CSC205), and a professorId.

Then a login dialog will be displayed to prompt the user (student or professor) to type in his/her Id. If the Id is not in either list, a dialog should be displayed to ask the user try again. The program should stop after three unsuccessful trials.

When the user successfully login, the system should display another dialog with appropriate information according to the user’s status. For a student, this dialog should display classes s/he is in sorted by classCode, in the format of <classCode> <professorName>. For a professor, the dialog should be displayed in the format <studentName> <id> <majorCode>. By default, a class roster is sorted in ascending order on student ids. So on the professor’s dialog options need to be provided to allow the professor choose among order by student name, major code, or id. Names should be displayed in the last-name-first format (i.e. <lastName>, <firstName>).

Design

As suggested in the previous section, you need to have a User class and an Enrollment class for this project. The user class can implement the Comparable interface and set its natural ordering based on its id. Think of providing getters/setters as needed for both classes, as well as toString method.

Write a main driver class to provide flow control. This class can use Scanner objects to access files. You can use the Scanner(Filesource) constructor to create these objects, as shown in the following code snippet. Then test whether there is more line to read before reading in the next record.

Scanner stdFile = new Scanner(new File("student.data"));

while (stdFile.hasNextLine()) {

line = stdFile.nextLine(); //line has been declared above

// parse line and create a User object, add it to a list

// using something like stdList.add(new User(line));

}

Parse the record using techniques that you have practiced in Lab 1 to get ids, names, etc, and then create a new User object and add it to a list (or an array).

You may use JOptionPane to display various dialogs (input, message, option, etc) as needed. To sort a roster in a specific order, you may use (inner) classes that implement the Comparator interface, as demonstrated in Lab 2.

Coding and Commenting

Use meaningful identifiers for your classes and variables. Format your code consistently. Try to use Javadoc style comments for your classes and methods. Don’t add too much commenting. Follow the examples in your text and use the IDE may help you meet this requirement more easily.

Testing

Use the data files as provided to test your program. Try your best to test the following cases:

-  Login with invalid an id;

-  Login with a student id, with more one class shown on the next dialog box;

-  Login with a professor id, with a handful of students in the class roster, and noticeable changes when switching from one sorting option to another.

Deliverables and Due Date

Send in code and screen shots in printed format by 9/20.

1