java吧 关注:1,259,870贴子:12,755,301
  • 11回复贴,共1

求大神解救!!!毕业的程序!!

只看楼主收藏回复

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
***************************************************************************/
}


1楼2013-12-14 08:08回复
    要求是 Main method 不能动。然后要用return来返回程序。
    温度之间的转换公式是
    From To Formula
    Celsius Kelvin [K]=[.C]+273.15
    Celsius Fahrenheit [F]==[C]*9/5+32
    Kelvin Celsius [C]=[K]-273.15
    Kelvin Fahrenheit [F]=[K]*9/5-459.67
    Fahrenheit Celsius [C]=([F]-32)*5/9
    Fahrenheit Kelvin [K]=([F]+459.67)*5/9


    2楼2013-12-14 08:15
    收起回复
      2025-05-16 21:57:49
      广告
      求各位大神解救!!!


      3楼2013-12-14 09:44
      收起回复
        卧槽,毕业程序就这个样子


        IP属地:广东来自Android客户端4楼2013-12-14 10:06
        收起回复
          支持一下


          IP属地:安徽来自Android客户端5楼2013-12-15 10:01
          回复