⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ming.java

📁 计算用JAVA语言编写一些小程序,简单计算器,绘图等.用JAVA语言编写银行管理系统.
💻 JAVA
字号:
 import javax.swing.JOptionPane;

public class ming{

   public static void main( String args[] )
   {
      int option;
      double degree1;
      double celsius1;
      double fahrenheit1;   
          
      String result;
      String degree;
      String fahrenheit;
      String input;
      String celsius;    
     
      option = 0; 
  
      while (option!=-1){
            
         input = JOptionPane.showInputDialog(
            " 1 for Fahrenheit to Celsius\n" +
            " 2 for Celsius to Fahrenheit\n -1 to quit:" );
     
         option = (int)Double.parseDouble( input );
         
         switch(option){
             case 1:
                 degree =JOptionPane.showInputDialog( "Enter thr degree in Fahrenheit: " );
         
                 degree1 = Double.parseDouble( degree ); 
     
                 celsius1 = ( degree1 - 32 ) * 5 / 9d; 
     
                 result = "The temp in Celsius is " + celsius1; 
     
                 JOptionPane.showMessageDialog( null, result, "Result",
            JOptionPane.INFORMATION_MESSAGE );
                 break;
             
             case 2:
           fahrenheit =JOptionPane.showInputDialog( "Enter thr Fahrenheit in degree: " );
         
                 fahrenheit1 = Double.parseDouble( fahrenheit ); 
     
                 celsius1 =fahrenheit1 * 9d/5+32; 
     
                 result = "The temp in Celsius is " + celsius1; 
     
                 JOptionPane.showMessageDialog( null, result, "Result",
            JOptionPane.INFORMATION_MESSAGE );
                 break;  
                 //摄氏温度转化为华氏温度的代码
         };        
         
      } // end while loop
      
   } // end method Main
   
} // end class Temperature

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -