From MAILER-DAEMON Wed Oct  6 20:23:27 1999
Date: Wed, 6 Oct 1999 20:23:27 -0400 (EDT)
From: Mail System Internal Data <MAILER-DAEMON@cs.cornell.edu>
Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA
X-IMAP: 0939255807 0000000000
Status: RO

This text is part of the internal format of your mail folder, and is not
a real message.  It is created automatically by the mail system software.
If deleted, important folder data will be lost, and it will be re-created
with the data reset to initial values.

From dis@cs.cornell.edu Wed Oct  6 19:08:46 1999 -0400
Status: R
X-Status: 
X-Keywords:
Received: from postoffice.mail.cornell.edu (POSTOFFICE.MAIL.CORNELL.EDU [132.236.56.7])
	by cloyd.cs.cornell.edu (8.9.3/8.9.3/M-2.4) with ESMTP id TAA10845
	for <dis@cs.cornell.edu>; Wed, 6 Oct 1999 19:08:43 -0400 (EDT)
Received: from cam.cornell.edu (MACOMB.CAM.CORNELL.EDU [132.236.122.12])
	by postoffice.mail.cornell.edu (8.9.3/8.9.3) with SMTP id TAA15398
	for <dis@cs.cornell.edu>; Wed, 6 Oct 1999 19:08:43 -0400 (EDT)
Received: by cam.cornell.edu (4.1/SMI-4.1)
	id AA18653; Wed, 6 Oct 99 19:08:40 EDT
Received: from avalanche(132.236.122.74) by macomb via smap (V2.1)
	id xma018651; Wed, 6 Oct 99 19:08:37 -0400
Received: from localhost (singer@localhost)
	by avalanche.cam.cornell.edu (8.9.3+Sun/8.9.1R1.1) with SMTP id TAA21861
	for <dis@cs.cornell.edu>; Wed, 6 Oct 1999 19:08:37 -0400 (EDT)
X-Authentication-Warning: avalanche.cam.cornell.edu: singer owned process doing -bs
Date: Wed, 6 Oct 1999 19:08:36 -0400 (EDT)
From: Mike Singer <singer@cam.cornell.edu>
X-Sender: singer@avalanche
To: David Schwartz <dis@CS.Cornell.EDU>
Subject: Sample Code for Homework 3 (fwd)
Message-Id: <Pine.SOL.3.96.991006190754.21761C-100000@avalanche>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

Here's what I posted on the newsgroup.  See ya' tomorrow (the agenda looks
good!).

Mike

---------- Forwarded message ----------
Date: Wed, 06 Oct 1999 19:06:37 -0400
From: Mike Singer <singer@cam.cornell.edu>
Subject: Sample Code for Homework 3
Newsgroups: cornell.class.cs100b

Hi all,

In hopes of making it easier for students to get started on homework 3,
please find below a sample of what your interval class might look like.
There are a number of way to write your interval class, but if you're
having
trouble getting started, you can look over the code below.

Let me know if you have questions.

Mike


class Interval {
    public double minimum;
    public double maximum;

    public Interval(double min, double max) {
        minimum = min;
        maximum = max;
    }

    public Interval addInterval(Interval addedInterval) {
        double tempMin = minimum + addedInterval.minimum;
        double tempMax = maximum + addedInterval.maximum;

        Interval tempInterval = new Interval(tempMin, tempMax);
        return tempInterval;
    }
}


Please note:  declaring class data public is NOT a good object-orientied

                        programming technique!!  It would be much better
to
                        implement the interval class as follows (but
either way is
                        fine for the homework)

class Interval {
    private double minimum;
    private double maximum;

    public Interval(double min, double max) {
        minimum = min;
        maximum = max;
    }

    public double getIntervalMinimum() {
        return minimum;
    }

    public double getIntervalMaximum() {
        return maximum;
    }

    public Interval addInterval(Interval addedInterval) {
        double tempMin = minimum + addedInterval.getIntervalMinimum();
        double tempMax = maximum + addedInterval.getIntervalMaximum();

        Interval tempInterval = new Interval(tempMin, tempMax);
        return tempInterval;
    }
}




