Class Station

java.lang.Object
  extended by Station

public class Station
extends Object

Represents a weather-station


Constructor Summary
Station(String name)
          Constructs a weather station
 
Method Summary
 void addObservation(Observation obs)
          Adds an observation to the list of obervations
 String getName()
          Gets the name of the statoion
static void main(String[] args)
          Test and demonstrates the Station class
 double meanWind()
          Computes the mean wind
 int numberOfObservations()
          Gets the number of observations
 int numberUsable(double low, double high)
          Count the number of usable wind observations
 void print()
          Produces a printout of the station together with its obeservations.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Station

public Station(String name)
Constructs a weather station

Parameters:
name - The name of the station
Method Detail

addObservation

public void addObservation(Observation obs)
Adds an observation to the list of obervations

Parameters:
obs - The observation to be added

getName

public String getName()
Gets the name of the statoion

Returns:
The name of the station

meanWind

public double meanWind()
Computes the mean wind

Returns:
The mean wind

numberOfObservations

public int numberOfObservations()
Gets the number of observations

Returns:
The number of observations

numberUsable

public int numberUsable(double low,
                        double high)
Count the number of usable wind observations

Parameters:
low - The lowest usable wind speed
high - The highest usable wind speed
Returns:
The number of usable observations

toString

public String toString()
Overrides:
toString in class Object
Returns:
A string representation of the station and its observations

print

public void print()
Produces a printout of the station together with its obeservations. The observations are written 5 per row.


main

public static void main(String[] args)
Test and demonstrates the Station class