Instructor: Phill Conrad
TAs: Esra Kucukoguz, Yiming Li, Murali Yeleswarapu
Primary TA for this lab: Esra Kucukoguz
Grader for this lab: TBA
You may choose to work individual, or in pairs on this lab—it is your choice.
You are permited to work in the same pairs you used for lab05/lab06, but it is not required.
Please indicate in your submission in the @author Javadoc comment for each file whether you worked individually or as a pair. For pairs, be sure both names are listed.
If you work individually, you may not collaborate or share code with anyone. Please seek help only from the TAs or the instructor.
If you work in pairs, please follow the usual pair programing practices—work at a single workstation, take turns being the driver and the navigator.
In this case, it is only necessary to make one submission via the "turnin" program—in fact, that is preferred. However, the student that does NOT do the turnin command should please email
and indicate who did the submission for the pair, cc'ing the email address of the student that did submit. Put "lab08" in the subject line.
Use that email only when instructed—don't use that email address for regular correspondence with Prof. Conrad.
Open a command line prompt in your ~/cs10/lab08 directory, and use the following command. Notice the space and the period at the end of the line—those are very important!
cp -r /cs/faculty/pconrad/public_html/cs10/09S/labs/lab08/lab08Project .
This command will copy a directory containing several Java files, plus all the extra files for a BlueJ project into your directory.
Other ways to access the code:
Now you should be able to open up the project in BlueJ if you like, however...
On this lab, it may be better to work OUTSIDE of BlueJ, at the command line.
If you copied the lab08Project correctly, you should be able to do an ls at the command line and see the files EasyCommandLineDemo.java, and CommandLineArgsDemo.java
Refamiliarize yourself with the code.
Then, try typing in some things at the command line such as:
java CommandLineArgsDemo foo bar fum
Note that if the 2nd and 3rd arguments are not an integer and a decimal number, then you exceptions are raised.
Your job: add one or more try/catch statements to the program so that you get "friendly" error messages instead of Java vomit all over the screen.
When you've done that, move on to step 2!
Now, look at ReadFileDemo.java, Student.java, and ReadFileIntoArrayListOfStudents.java.
These show how to read from a file. Refamiliarize yourself with the code. Notice how the split method is used to break up the line of comma separate values.
Then, modify Student.java, and ReadFileIntoArrayListOfStudents.java so that in addition to name and gpa, each student has a perm number as well. You will need to add code to the constructor and the toString method of the Student class, as well as modifying the file students.dat so that each line has a perm Number after name and gpa, e.g.:
Dan Kouda,4.0,1234567 Zack Zarburg,0.5,7654321 Fred Friendly,3.5,2468123 Sheila Standoffish,3.9,9874563
When your program can correctly read this file into an ArrayList of students, then print back the students with their name, gpa and permNumbers, you are finished.
Use turnin to submit your entire lab08 directory to lab08@cs10
Points for this lab are distributed as follows. Partial credit may be awarded for each step at the discretion of the TA/Instructor.
Total points: ?
Due Date: We'll accept this assignment up without penalty up until 5pm, June 5.
Submissions turned in after that time are subject to receiving zero credit—they will be graded only they arrive before the TA finishes work on grading the entire "batch" of assignments submitted.
End of lab08