//******************************************************************** // TempConverter.java // // Author: Lewis and Loftus // Destroyer: felipe // // Demonstrates the use of primitive data types and arithmetic // expressions. //******************************************************************** /* * la ligne suivante indique que vous souhaitez utiliser la classe Keyboard * voir demo1 pour la configuration de votre variable CLASSPATH */ import Keyboard; /* * */ public class TempConverter { //----------------------------------------------------------------- // Computes the Fahrenheit equivalent of a specific Celsius // value using the formula F = (9/5)C + 32. //----------------------------------------------------------------- public static void main (String[] args) { final int BASE = 32; final double CONVERSION_FACTOR = 9.0 / 5.0; System.out.print("Entrez une temperature en celsius: "); int celsiusTemp = Keyboard.readInt(); // la lecture depuis le clavier double fahrenheitTemp; fahrenheitTemp = celsiusTemp * CONVERSION_FACTOR + BASE; System.out.println ("Celsius Temperature: " + celsiusTemp); System.out.println ("Fahrenheit Equivalent: " + fahrenheitTemp); } }