代码:
import javax.swing.*;
public class bb{
public static void main(String[] args){
String input = JOptionPane.showInputDialog(null,"Enter a degree in Celsius","changeDegree",JOptionPane.QUESTION_MESSAGE);
double Celsius = Double.parseDouble(input);
double Fahrenheit = (9.0/5)*Celsius+32;
String result = Celsius+" Celsius is "+Fahrenheit+" Fahrenheit";
JOptionPane.showMessageDialog(null,result);
}
}
结果:
时间: 2024-10-22 05:34:01