CSC 217 Lab 10 - Iterators

CSC 217 Lab 10 - Implement and Test FacultyRecordIO

CSC 217 Lab 10 Implement and Test FacultyRecordIO

Like StudentRecordIO, FacultyRecordIO provides static methods that support reading in faculty records from a file and writing faculty records to a file. A faculty record is defined in the [Faculty Records data format]. The read functionality supports [UC19] and the write functionality supports [UC20].

The two required public methods for FacultyRecordIO are similar to StudentRecordIO. The only difference is that the methods return a LinkedList (the specialized class you just created) rather than ArrayList.

Since the methods of FacultyRecordIO are static, FacultyRecordIO doesn’t require a defined constructor. There is a constructor listed in the design, but that is the default constructor that all classes without explicitly defined constructors have. Do NOT define a constructor for FacultyRecordIO. There is no state to initialize.

Create FacultyRecordIOTest

Create FacultyRecordIOTest in the edu.ncsu.csc216.pack_scheduler.io package of the test/ source folder. Start by creating tests for the FacultyRecordIO class as described in the design. Since FacultyRecordIO is so similar to StudentRecordIO, use StudentRecordIOTest as a model for your FacultyRecordIOTest class.

We have provided several files that can help you with testing the faculty functionality:

readFacultyRecords(String) Implementation

readFacultyRecords(String fileName) will read in Faculty records from the file represented by the given fileName. The records are returned in an LinkedList<Faculty> in a manner very similar to StudentRecordIO.readStudentRecords() from Lab 01. The method will throw a FileNotFoundException if the file does not exist on the file system.

Conceptual Knowledge: Reading Hashed Strings

Faculty passwords are stored in a hashed string. The hashed string consists of characters with an underlying integer value between 0 and 255. The values between 0 and 127 are a determined set of characters from the standard alphabet and other control characters. The values between 128 and 255 are interpreted by different programs using different extended interpretations. The above link has some examples.

Because you are working with character strings, using a File parameter to the Scanner object is not sufficient. The hashes are really bytes of data and not a string you would read. So instead of using a File parameter, you should instead use a FileInputStream. FileInputStream lets you read the input file as a series of bytes rather than a series of characters. After the Scanner is created using the FileInputStream, you can work with the Scanner the same way you are used to.

writeFacultyRecords(String, LinkedList<Faculty) Implementation

writeFacultyRecords(String fileName, LinkedList<Faculty> facultyDirectory) will write the Faculty in facultyDirectory to the file represented by the fileName one Faculty record at a time. The records are written in a very similar manner to StudentRecordIO.writeStudentRecords() from Lab 01. The method will throw an IOException if unable to write to the file.

Javadoc your Code

Javadoc the FacultyRecordIO class and its methods.

Run CheckStyle to ensure that your Javadoc has all elements.

Push to GitHub

Push your PackScheduler project to GitHub

  • Add the unstaged changes to the index.
  • Commit and push changes. Remember to use a meaningful commit message describing how you have changed the code.

Reminder: Staging and Pushing to GitHub

GitHub Resources:

Check Jenkins

Ensure that your Jenkins job is reflecting the results that you expect for the level of completion of your lab assignment.

Reminder: Interpreting Jenkins

Check the following items on Jenkins for your last build and use the results to estimate your grade: