class ????{
// Main Method
public static void main( String[] args ){
char scaleFrom = ' '; // From which temperature scale to convert from
char scaleTo = ' '; // To which temperature scale to convert to
double tempFrom = 0.0; // Temperature value to be converted
double tempTo = 0.0; // Temperature value converted
double result = 0.0; // Result of the conversion
// Loop to repeat the menu until option chosen is "x"
do {
/*
Method to display the menu and store the scale from
which the temperature will be converted from
*/
scaleFrom = displayMenu();
/*
Only asks user to input more information,
if scaleFrom is different than "x" ( x = Exit )
*/
if ( scaleFrom != 'x' ){
/*
Method to get the temperature value to be
converted and store the value entered by user
*/
tempFrom = getTemp();
/*
Method to get the scale to which the
temperature value will be converted to
*/
scaleTo = getUnitTo();
// Method to convert the Temperature
result = convertTemp( scaleFrom, tempFrom, scaleTo );
// Method to display the conversion to the screen
displayResult( scaleFrom, tempFrom, scaleTo, result );
}
} while ( scaleFrom != 'x' );
}
// Method to invoke the conversion of the temperature
public static double convertTemp( char uFrom, double temp, char uTo ){
// body of the Method
}
// Method to convert temperatures in Celsius to the other ones
public static double convFromCelsius( double value, char unitTo ){
// body of the Method
}
// Method to convert temperatures in Fahrenheit to the other ones
public static double convFromFahrenheit( double value, char unitTo ){
// body of the Method
}
// Method to convert temperatures in Kelvin to the other ones
public static double convFromKelvin( double value, char unitTo ){
// body of the Method
}
/*************************************************************************
Implement here the other methods needed
***************************************************************************/
}
// Main Method
public static void main( String[] args ){
char scaleFrom = ' '; // From which temperature scale to convert from
char scaleTo = ' '; // To which temperature scale to convert to
double tempFrom = 0.0; // Temperature value to be converted
double tempTo = 0.0; // Temperature value converted
double result = 0.0; // Result of the conversion
// Loop to repeat the menu until option chosen is "x"
do {
/*
Method to display the menu and store the scale from
which the temperature will be converted from
*/
scaleFrom = displayMenu();
/*
Only asks user to input more information,
if scaleFrom is different than "x" ( x = Exit )
*/
if ( scaleFrom != 'x' ){
/*
Method to get the temperature value to be
converted and store the value entered by user
*/
tempFrom = getTemp();
/*
Method to get the scale to which the
temperature value will be converted to
*/
scaleTo = getUnitTo();
// Method to convert the Temperature
result = convertTemp( scaleFrom, tempFrom, scaleTo );
// Method to display the conversion to the screen
displayResult( scaleFrom, tempFrom, scaleTo, result );
}
} while ( scaleFrom != 'x' );
}
// Method to invoke the conversion of the temperature
public static double convertTemp( char uFrom, double temp, char uTo ){
// body of the Method
}
// Method to convert temperatures in Celsius to the other ones
public static double convFromCelsius( double value, char unitTo ){
// body of the Method
}
// Method to convert temperatures in Fahrenheit to the other ones
public static double convFromFahrenheit( double value, char unitTo ){
// body of the Method
}
// Method to convert temperatures in Kelvin to the other ones
public static double convFromKelvin( double value, char unitTo ){
// body of the Method
}
/*************************************************************************
Implement here the other methods needed
***************************************************************************/
}