Lab 5

Streams

February 16, 2006

Lab Partners

You may work with one partner on this in lab.

Objective

The objective of this lab is to allow you to practice reading from files in Java.

Before Starting

Create a BlueJ project named inlab5 and copy Lab5.java, Statistics.java and grades.txt into it.

Each line of the grades.txt file contains the last name of a CS 221 student, followed by a comma, followed by one or more spaces, followed by the corresponding first name, followed by one or more spaces, followed by a randomly made-up corresponding average for the student.

Mean Calculation: 5 points

Supply the proper code for the calculateMean() method in the Statistics.java file. The method should calculate and return the average grade in the file. This method is required to read the grades.txt file. Do not modify the Lab5.java file at all!

Sample Standard Deviation Calculation: 5 points

Supply the proper code for the calulateStandardDeviation(double mean) method in the Statistics.java file. The method should calculate and return the sample standard deviation of the grades. The sample standard deviation, sN, can be calculated using the following formula:



where N is the total number of grades and the x with the bar over it is the mean of the grades in the file. This method is required to read the grades.txt file. Do not modify the Lab5.java file at all!

What to Submit

E-mail the modified Statistics.java class to your lab TA in one message. The subject of the message should be: CS221-xx inlab5 your-names. The xx is the number of your lab section.

Before You Leave

Delete the inlab5 project that you created. Empty the recycle bin. Thank you.