Class TemperatureReading4

java.lang.Object
  |
  +--TemperatureReading4

public class TemperatureReading4
extends java.lang.Object

This class encapsulates the data from a temperature reading. The details of how a temperature is stored are hidden from the user of objects created from this class. The public interface of this class requires that the scale of a temperature must always be specified. This provides a safe way to store temperature values.


Field Summary
static double BOILING_C
           
static double BOILING_F
           
static double FREEZING_C
           
static double FREEZING_F
           
 
Constructor Summary
TemperatureReading4(char scale, double temperature, double latitude, double longitude)
          A constructor that specifies a scale for the temperature.
 
Method Summary
static double convertCtoF(double degreesC)
          A static method that converts numbers from a Celsius value to a Fahrenheit value.
static double convertFtoC(double degreesF)
          A static method that converts numbers from a Fahrenheit value to a Celsius value.
 double getLatitude()
          Retrieve the latitude of where the temperature reading was made.
 double getLongitude()
          Retrieve the longitude of where the temperature reading was made.
 double getTemperatureC()
          Retrieve the temperature value using the Celsius scale.
 double getTemperatureF()
          Retrieve the temperature value using the Fahrenheit scale.
 java.util.Date getTimeOfReading()
          Retrieve the date of when the temperature reading was made.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BOILING_C

public static final double BOILING_C
See Also:
Constant Field Values

BOILING_F

public static final double BOILING_F
See Also:
Constant Field Values

FREEZING_C

public static final double FREEZING_C
See Also:
Constant Field Values

FREEZING_F

public static final double FREEZING_F
See Also:
Constant Field Values
Constructor Detail

TemperatureReading4

public TemperatureReading4(char scale,
                           double temperature,
                           double latitude,
                           double longitude)
A constructor that specifies a scale for the temperature.

Parameters:
scale - specifies the scale for temperature, either 'F' or 'C'
temperature - the temperature in either Celsius or Fahrenheit
latitude - the latitude of the reading
longitude - the longitude of the reading
Method Detail

convertCtoF

public static double convertCtoF(double degreesC)
A static method that converts numbers from a Celsius value to a Fahrenheit value.

Parameters:
degreesC - a number that is interpreted as a temperature in degrees Celsius

convertFtoC

public static double convertFtoC(double degreesF)
A static method that converts numbers from a Fahrenheit value to a Celsius value.

Parameters:
degreesF - a number that is interpreted as a temperature in degrees Fahrenheit

getLatitude

public double getLatitude()
Retrieve the latitude of where the temperature reading was made.


getLongitude

public double getLongitude()
Retrieve the longitude of where the temperature reading was made.


getTemperatureC

public double getTemperatureC()
Retrieve the temperature value using the Celsius scale.


getTemperatureF

public double getTemperatureF()
Retrieve the temperature value using the Fahrenheit scale.


getTimeOfReading

public java.util.Date getTimeOfReading()
Retrieve the date of when the temperature reading was made.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object