将摄氏温度转化为华氏温度

代码:

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);
}
}

结果:

原文地址:https://www.cnblogs.com/ncuhwxiong/p/5846877.html