public class UnitConvModel
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
double |
CM_PER_INCH
Represents the number of centimetres in an inch.
|
double |
KG_PER_LBS
Represents the number of kilograms in a pound.
|
Constructor and Description |
---|
UnitConvModel()
Creates a model with no user values and a calculated value
of zero.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Re-initialises this model with a calculated value of zero.
|
void |
cmToInches(double cm)
Converts the passed value in centimetres to the corresponding
length in inches.
|
void |
cToF(double c)
Converts the passed value in Celcius to the corresponding
temperature in Fahrenheit
|
void |
fToC(double f)
Converts the passed value in Fahrenheit to the corresponding
temperature in Celcius
|
double |
getInputValue()
Returns the input value of this model.
|
double |
getResultValue()
Returns the converted value calculated by this model.
|
void |
inchesToCm(double in)
Converts the passed value in inches to the corresponding
length in centimetres.
|
void |
kgToLbs(double kgs)
Converts the passed value in kilograms to the corresponding
weight in pounds.
|
void |
lbsToKg(double lbs)
Converts the passed value in pounds to the corresponding
weight in kilograms.
|
void |
save(java.io.File file)
Saves the current conversion to a file in plain text.
|
public final double KG_PER_LBS
public final double CM_PER_INCH
public UnitConvModel()
public void clear()
public double getInputValue()
public double getResultValue()
public void save(java.io.File file)
file
- the file to create for the outputpublic void cmToInches(double cm)
cm
- a length in centimetrespublic void inchesToCm(double in)
in
- a length in inchespublic void lbsToKg(double lbs)
lbs
- a weight in poundspublic void kgToLbs(double kgs)
kgs
- a weight in kilogramspublic void cToF(double c)
c
- a temperature in Celciuspublic void fToC(double f)
f
- a temperature in Fahrenheit