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

📄 temperature.java

📁 Java 入门书的源码
💻 JAVA
字号:
//Copyright (c) 1998, Arthur Gittleman
//This example is provided WITHOUT ANY WARRANTY either expressed or implied.

/*  Uses method from the Io class provided
 *  with the text, to convert degrees Celsius
 *  to degrees Fahrenheit
 */

import iopack.Io;
public class Temperature {
   public static void main(String [ ] args) {
       double  hotC, coldC;
       double  hotF, coldF;
       hotC = Io.readDouble("Enter a hot temperature in Celsius");
       hotF = 9.0*hotC/5.0 + 32.0;
       System.out.print("The Fahrenheit temperature is: ");
       Io.println(hotF, 1);
       coldC = Io.readDouble("Enter a cold temperature in Celsius");
       coldF = 9.0*coldC/5.0 + 32.0;
       System.out.print("The Fahrenheit temperature is: ");
       Io.println(coldF,1);
       Io.readString("Press any key to exit");   // Added for IDE use
   }
}

⌨️ 快捷键说明

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