Lab 2

Code for this lab

Our labs will be 1 off from what the actual file says (i.e. we are on lab 2 but the file says lab 1)

For the remainder of our labs (unless Lewis or I decide otherwise) we will be using Dr. Buell's labs from when he taught this course

This lab is fairly simple, but first you need to get the folder open inside Eclipse.

There is probably another way to do this but I will tell you my way

Unzip the folder, put the contents into your workspace (probably in your Z: drive), inside Eclipse click file->import, under General there is an option for import existing projects into workspace, click that, find your workspace and click it, make sure folder pops up in window, click ok

Now that we have the lab, we can see that we have 4 files in the src (source) folder. These are: Driver.java, FileUtils.java, FlatFile.java, and Record.java

We also have some input files (zin, zin.after, zin.before)

If we try to run this now nothing will happen. Actually, it will crash. If you look at the error you can see that we have an issue with input. Let's start there. If we look at our code we can see that a record is the equivalent to a phonebook entry (like it says in the comments, imagine that). This, along with our error, tell us where we need to be looking for the next part.

If you look at the Record class along side the input (zin) you will see something isn't right. There is a field that isn't being addressed there. There are office hours listed in the input file, but the record class doesn't handle them.

The goal of lab 2 is the add code to the Record class so that it is able to handle the input from the zin file. In other words we want to make the Record class be able to read the office hours in and store them

This will require accessors and mutators (getters and setters), adding an Instance variable, and editing the constructor, the readRecord method, and the toString methods

Hint: For the toString method you might use %18s in the string format call