All pastes #206159 Raw Edit

Miscellany

public text v1 · immutable
#206159 ·published 2006-10-17 08:36 UTC
rendered paste body
public class Temperature
{
 // instance variables
    private double temperature;
    private char scale;
    
    // constructors
    public Temperature()
    {
        temperature = 0;
        scale = 'C';
    }
    public Temperature(int temp) 
    {
     setTemperature(temperature);
    }
    public Temperature( char s )   
    { 
        setTemperature(s);
    }
    public Temperature(int temp, char s) 
    {  
       setTemperature(temp, s);
    }
 
    // accessor methods
    public double getTempFahrenheit(int cel)  
    { 
        double far;
        far = (9(cel)/5)) + 32;
        return far;
    }
    public double getTempCelsius(int far )  
    {  
        double cel;
        cel = 5(far-32)/9;
        return cel;
    }
    
    // mutator methods
    public void setTemperature( int newTemp ) 
    {  
        this.newTemp = 0;
    }
    public void setScale( char newScale )  
    { 
        this.newScale = 'C';
    }
    public void setTempScale( int newTemp, char newScale )  
    { 
        this.newTemp = 0;
        this.newScale = 'C';
    }
    
    // comparison methods
    public boolean equals( Temperature anotherTemp ) 
    { 
    }
    public boolean greaterThan( Temperature anotherTemp) 
    { 
    }
    public boolean lessThan( Temperature anotherTemp ) 
    { 
    }
    
    // toString method
    public String toString( )  
    {  
    
    }
    
   }