Write a program that prompts the user for a measurement in meters and then converts it into miles, feet, and inches. Use a class
public class Converter
{
/**
Constructs a converter that can convert between two units.
\@param aConversionFactor the factor by which to multiply
to convert to the target unit
*/
public Converter(double aConversionFactor) { . . . }
/**
Converts from a source measurement to a target measurement.
\@param fromMeasurement the measurement
\@return the input value converted to the target unit
*/
public double convertTo(double fromMeasurement) { . . . }
/**
Converts from a target measurement to a source measurement.
\@param toMeasurement the target measurement
\@return the value whose conversion is the target measurement
*/
public double convertFrom(double toMeasurement) { . . . }
}
In your ConverterTester class, construct and test the following Converter object:
final double MILE_TO_KM = 1.609;
Converter milesToMeters = new Converter(1000 * MILE_TO_KM);