ITP 100 Temperature Class UML

Shared by: nuhman10
-
Stats
views:
5
posted:
5/12/2011
language:
English
pages:
2
Document Sample
scope of work template
							                         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; }

						
Related docs
Other docs by nuhman10
GA2010-1100061
Views: 503  |  Downloads: 4
GA2010-1100060
Views: 127  |  Downloads: 0
GA2010-1100059
Views: 81  |  Downloads: 0
GA2010-1100058
Views: 95  |  Downloads: 0
GA2010-1100057
Views: 50  |  Downloads: 0
GA2010-1100056
Views: 54  |  Downloads: 0
GA2010-1100052
Views: 57  |  Downloads: 0
GA2010-1100055
Views: 47  |  Downloads: 0
GA2010-1100054
Views: 46  |  Downloads: 0
GA2010-1100053
Views: 75  |  Downloads: 0