|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.colorado.homework.Statistician
public class Statistician
This class is a homework assignment;
A Statistician keeps track of statistics about a sequence of
double numbers.
| Constructor Summary | |
|---|---|
Statistician()
Initialize a new Statistician. |
|
| Method Summary | |
|---|---|
void |
addAll(Statistician addend)
Add the numbers of another Statistician to this Statistician. |
void |
clear()
Clear this Statistician. |
boolean |
equals(java.lang.Object obj)
Compare this Statistician to another object for equality. |
int |
length()
Determine how many numbers have been given to this Statistician. |
double |
maximum()
Determine the largest number that has been given to this Statistician. |
double |
mean()
Determine the arithmetic average of all the numbers that have been given to this Statistician. |
double |
minimum()
Determine the smallest number that has been given to this Statistician. |
void |
next(double number)
Give a new number to this Statistician. |
double |
sum()
Determine the sum of all the numbers that have been given to this Statistician. |
static Statistician |
union(Statistician s1,
Statistician s2)
Create a new Statistician that behaves as if it was given all the numbers from two other bags. |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Statistician()
- - none
| Method Detail |
|---|
public void addAll(Statistician addend)
addend - a Statistician whose numbers will be added to this Statistician
addend, is not null.
addend have been added to this
Statistician. After the operation, this Statistician acts as if
if was given all of its numbers and also given all of the numbers
from the addend.
java.lang.NullPointerException - Indicates that addend is null.public void clear()
- - none
public boolean equals(java.lang.Object obj)
Statistician to another object for equality.
equals in class java.lang.Objectobj - an object with which this Statistician will be compared
true indicates that
obj refers to a
Statistican object with the same length, sum, mean,
minimum and maximum as this
Statistician. Otherwise the return value is
false.
obj is null or does not refer to a
Statistician object, then the answer is
false.public int length()
- - none
Integer.MAX_VALUE numbers, will
cause failure with an arithmetic overflow.public double maximum()
- - none
length() is zero, then the answer from this method
is Double.NaN.public double mean()
- - none
Integer.MAX_VALUE numbers, then this method fails
because of arithmetic overflow.
If length() is zero, then the answer from this method
is Double.NaN.
If sum() exceeds the bounds of double numbers, then the
answer from this method may be
Double.POSITIVE_INFINITY or
Double.NEGATIVE_INFINITY.public double minimum()
- - none
length() is zero, then the answer from this method
is Double.NaN.public void next(double number)
number - the new number that is being given the this Statistician
public double sum()
- - none
Double.POSITIVE_INFINITY or
Double.NEGATIVE_INFINITY.
public static Statistician union(Statistician s1,
Statistician s2)
s1 - the first of two Statisticianss2 - the second of two Statisticians
NullPointerException. - Indicates that one of the arguments is null.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||