正在加载图片...
JOptionPane.showInputDialog("Enter thr degree in Fahrenheit:"). degree1=Double.parseDouble(degree celsius1 =(degree1-32)*5/9 result="The temp in Celsius is"+celsiusl if(option=2)月 degree=JOptionPane.showInputDialog("Enter degree in Celsius:"); degreel=Double.parseDouble(degree ) fahrenheitl=(degreel9/5)+32: result="The temp in Fahrenheit is"+fahrenheitl; System.exit(0)月 }∥end while loop }∥end method Main )//end class Temperature 能数是有是日文数。根器~冲的注邦特下面的图序补充完玉,使之编样适过并 ing JOptionPane public class Palindrome String resultString.//result String int number INumber rinput number value in umber for ouput int digit2 ∥second digit nt dig int digits: //number of digits in input number =0; digits=0:JOptionPane.showInputDialog( "Enter thr degree in Fahrenheit: " ); degree1 = Double.parseDouble( degree ); celsius1 = ( degree1 - 32 ) * 5 / 9; result = "The temp in Celsius is " + celsius1; JOptionPane.showMessageDialog( null, result, "Result", JOptionPane.INFORMATION_MESSAGE ); if ( option == 2 ); degree = JOptionPane.showInputDialog( "Enter degree in Celsius: " ); degree1 = Double.parseDouble( degree ); fahrenheit1= ( degree1 * 9 / 5 ) + 32; result = "The temp in Fahrenheit is " + fahrenheit1; JOptionPane.showMessageDialog( null, result, "Result", JOptionPane.INFORMATION_MESSAGE ); System.exit( 0 ); } // end while loop } // end method Main } // end class Temperature 2.判断一个数是否是回文数。根据/**/中的注释将下面的程序补充完整,使之编译通过并 能正确运行。 import java.awt.*; import javax.swing.JOptionPane; public class Palindrome { // main method begins execution of Java application public static void main( String args[] ) { String resultString; // result String int number; // user input number int originalNumber; // stores original value in number for output int digit1; // first digit int digit2; // second digit int digit4; // fourth digit int digit5; // fifth digit int digits; // number of digits in input number = 0; digits = 0; /* Write code that inputs a five-digit number. Display an error message if the number is not five digits. Loop until a valid input is received. */
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有