Project #4
(Partial Spring Registration)
(Due 1 November 2006)
Each fall, the NS&M students register for Spring classes. This year they registered early for classes that are taught by NS&M and their actions were recorded in the file registration.txt Each line of this file shows a student transaction in the form
StudentNumber Action CourseNumber
for example: 401256 A 21057
where the StudentNumber is a six-digit integer that identifies the student; the Action is either an 'A' to indicate Adding the course to or a 'D' to indicate dropping the course from the student's Spring schedule; and the CourseNumber is a five-digit course reference number in the range 21000 to 21250.
A second file contains the identities of the students who were expected to register; this file is named identification.txt For each such student, the file contains one line looking like this
StudentNumber LastName, FirstName
for example: 467112 Alligator, Albert
The StudentNumber is a six-digit number; the First name is separated from the Last name by a comma and a space. The students are listed in this file in alphabetical order. Those student names that are not unique, such as Brown, Charlie, appear in the file next to each other with the lowest student number first.
You are to write a program to read the files, form the Spring schedules for all students and form the class rosters for each course that NS&M teaches. The program must write the student schedules to a binary file (Little Endian form) in alphabetical order and to write the class rosters to a binary file (Little Endian form) in any convenient order. The student schedules file should be named <lastname>Schedules.dat where you have replaced <lastname> with your own last name. Each record in this file consists of
Student Number: 4-byte
integer
Length of student name: 1-byte integer
Student Name:
an appropriate number of bytes to hold the name (one byte per character),
including the comma and space
Number of courses: 1-byte
integer
Course Numbers: an appropriate
number of 2-byte integers, each course reference number
representing a course
The class rosters file should be named <lastname>Rosters.dat where you have replaced <lastname> with your own last name. Each record in this file consists of
Course Reference Number: 2-byte integer
Number of students:
1-byte integer
Student Numbers: an
appropriate number of 4-byte integers, each representing a student
Notes: The registration.txt file may have "Add" events which were not completed (situations in which a student tries to add a course s/he already has in his/her schedule). Your program should report these invalid attempts at the console. There are no "Drop" events which were not completed because the students can only choose to drop from courses for which they already are registered. The identification.txt file may contain the student number and name for some students who have not yet registered. When writing the Schedules.dat file, these students should be skipped - they have no schedule; however, they should be reported at the console.
You have the following requirements for the program:
Hand in a well documented printout of your
program and a printout of all console output from executing the program.
Also, on the P: drive in your folder for this course, make a folder for
project #4 and put in it all .java files associated with the project and
the Schedules.dat and Rosters.dat files from executing your program.