Class Observation

java.lang.Object
  extended by Observation

public class Observation
extends Object


Constructor Summary
Observation(double wind, double temp)
           
 
Method Summary
 double getTemp()
           
 double getWind()
           
static void main(String[] args)
          Test and demonstration program
static Observation read(Scanner fsc)
          Reads the observation data from a stream using an already created Scanner object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Observation

public Observation(double wind,
                   double temp)
Parameters:
wind - Wind speed
temp - Temperature
Method Detail

toString

public String toString()
Overrides:
toString in class Object
Returns:
A string representation

getWind

public double getWind()
Returns:
The wind speed

getTemp

public double getTemp()
Returns:
The temperature

read

public static Observation read(Scanner fsc)
Reads the observation data from a stream using an already created Scanner object.
If the first item to be read is anything else but a number, null will be returned
If the first item is a number but the second is not, an exception will be thrown
If the first two items are numbers, an Observation object with these values as wind and temperature will be created an returned.

Parameters:
fsc - A created Scanner object
Returns:
An observation object or null
Throws:
RuntimeException - if only a part of an observation could be read.

main

public static void main(String[] args)
Test and demonstration program