|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectTemperature
public class Temperature
Temperature.java Class for temperature objects Ref: #7,413,4th AHD, Thurs 18th October 2007, 11:10 PT Please report any errors or omissions in this file. This is a class designed primarily to represent temperature records. It allows default initialisations of variables, get and set methods for variables, temperature comparison and conversion methods. To help with the understanding of the class, this java code has been commented for javadoc.exe, p1034-1035,4th Ed following the style in SavitchIn.java javadoc.exe has been run on this file (see instructions below) to create a web page documenting the Temperature.java class. You can inspect this webpage at: http://www.annedawson.com/Temperature.html To run javadoc, assuming the Java SDK is located here: C:\j2sdk1.4.2_01 and assuming the Temperature.java file is in C:\temp Click on the Start button on the desktop Select Run Browse for this file: C:\j2sdk1.4.2_01\bin\javadoc.exe and in the Run textbox add the text exactly as here: C:\j2sdk1.4.2_01\bin\javadoc.exe -d c:\temp C:\temp\Temperature.java and click on OK to run IMPORTANT NOTE: if you installed java to the Program Files folder, for "Program Files" substitute "Progra~1" in the path, e.g.: C:\Progra~1\Java\jdk1.6.0_02\bin\javadoc.exe -d c:\temp C:\temp\Temperature.java the "-d c:\temp" is a javadoc flag specifying that the destination folder to write the html documentation files to is C:\temp when you supply a .java file name to javadoc, you must give the full path, e.g. C:\temp\Temperature.java Reference: www.annedawson.com/javadoc.htm
| Constructor Summary | |
|---|---|
Temperature()
Default Constructor: sets temperature to O and scale to 'C' |
|
Temperature(char s)
Constructor: initialises scale to parameter s |
|
Temperature(double t)
Constructor: initialises temperature to parameter t |
|
Temperature(double t,
char s)
Constructor: initialises scale to parameter s and temperature to t |
|
| Method Summary | |
|---|---|
boolean |
equals(Temperature otherObject)
General method: checks if objects have equal temperatures |
double |
getCelsiusTemperature()
Accessor method: gets the C temperature value |
double |
getFahrenheitTemperature()
Accessor method: gets the F temperature value |
boolean |
greaterThan(Temperature otherObject)
General method: checks if temperature of current object is greater than that of other object |
boolean |
lessThan(Temperature otherObject)
General method: checks if temperature of current object is less than that of other object |
void |
set(char newScale)
Mutator method: sets the object's scale value with param |
void |
set(double newTemp)
Mutator method: sets the object's temperature value with param |
void |
set(double newTemp,
char newScale)
Mutator method: sets the object's scale and temperature values with params |
void |
writeOutput()
General method: writes the object's values to screen |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Temperature()
public Temperature(double t)
t - This is a number representing the temperaturepublic Temperature(char s)
s - This is a character representing the scale
public Temperature(double t,
char s)
s - This is a character representing the scalet - This is a number representing the temperature| Method Detail |
|---|
public double getCelsiusTemperature()
public double getFahrenheitTemperature()
public void writeOutput()
public void set(double newTemp)
newTemp - This is the new temperature.public void set(char newScale)
newScale - This is the new scale.
public void set(double newTemp,
char newScale)
newTemp - This is the new temperature.newScale - This is the new scale.public boolean equals(Temperature otherObject)
otherObject - This is the object to compare to the current objectpublic boolean greaterThan(Temperature otherObject)
otherObject - This is the object to compare to the current objectpublic boolean lessThan(Temperature otherObject)
otherObject - This is the object to compare to the current object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||