Last modified: 08/27/2007 16:12:18

54-283 CS 2 - Chapter 2 - Programming Assignment  Implement and Test the Statistician Class

Project Report: You must have a correctly compiling statistician class with stubs for all methods so that StatTest.java will compile and run, but not necessarily with correct answers. You must have a constructor and private instance variable.  Be able to discuss how you plan to implement all methods.


Note: Viewing current or past student solutions to this problem would consitute a violation of Southwestern University's Honor Code.

The Assignment:
You will complete the implementation and test a small class called Statistician, which is similar to some of the small classes in Chapter 2 of the text.
Purposes:
Ensure that you can write a small class that meets a precise specification.
Give you experience in using a test program to track down bugs in a class's implementation.
Before Starting:
Read all of Chapter 2.
Know how to compile and run java programs on your system.
File that you must complete:
Other files that you may find helpful:
  1. StatTest.java A simple interactive test program.
  2. Statistician.html A detailed discussion of the specification.
  3. statexam.java a test program
Hand in:
  1. A memory stick with a folder clearly labeled Lab1 which contains my program StatTest.java and your Statisitican.java
  2. A printout of the code for Statistician.Java

 The Statistician Class 
Discussion of the Assignment

You will implement a new class called Statistician, the specification (most of which is written for you) and the implementations for the class specification which you must finish . The Statistician is a class that is designed to keep track of simple statistics about a sequence of real numbers. There are two member methods that you should understand at an informal level before you proceed any further. The prototypes for these two functions are shown here as part of the Statistician class declaration:As indicated above,
public double mean( )
   {
      // The student's code will replace this return statement:
      return 0.0;
   }

public void next(double number)
{
}

modified by Rick Denman to use JUnit for testing