Class Observation
java.lang.Object
Observation
public class Observation
- extends Object
Constructor Summary |
Observation(double wind,
double temp)
|
Observation
public Observation(double wind,
double temp)
- Parameters:
wind
- Wind speedtemp
- Temperature
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