ITP 100 Temperature Class UML by nuhman10

VIEWS: 7 PAGES: 2

									                         Unified Modeling Language
                         Temperature Class UML

                                  Class: Temperature

                  -fahrenheit: double
                  -celsius: double


                  + Temperature ( ) // Default constructor
                  + Temperature (double fah) // Sets Fahren temp
                  + Temperature (double cel) // Sets Celsius temp
                  + calcFahren(double cel) : double
                  + calcCelsius (double fah) : double
                  + setFahren(double f) : void
                  + setCelsius (double c) : void
                  + getFahren( ) : double
                  + getCelsius( ): double


public Temperature ( )
{
  fahrenheit = 0.0;
  celsius = 0.0;
}

public Temperature (double fah)
{
  fahrenheit = fah;
}
public Temperature (double cel)
{
  celsius = cel;
}
public double calcFahren (double cel)
{
fahrenheit = (9./5.) * cel + 32;
return (fahrenheit);
}
public double calcCelsius (double fah)
{
celsius = (5./9.) * (fah – 32);
return (celsius);
}
public void setFahren (double f)
{
 fahenheit = f; }

public double getFahren ( )
{ return fahrenheit; }
public void setCelsius (double c)
{
 celsius = c; }

public double getCelsius ( )
{ return celsius; }

								
To top