TempConverter2 - public static void main(String args final...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // TempConverter2.java Author: Lewis and Loftus // // Solution to Programming Project 2.4 //******************************************************************** / import java.util.Scanner; i public class TempConverter2 { //----------------------------------------------------------------- // Computes the Celsius equivalent of a Fahrenheit value read // from the user. Uses the formula C = (5/9)(F - 32). //-----------------------------------------------------------------
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: public static void main (String args) { final int BASE = 32; final double CONVERSION_FACTOR = 5.0 / 9.0; double celsiusTemp, fahrenheitTemp; Scanner sc = new Scanner(System.in); System.out.print ("Enter a Fahrenheit temperature: "); fahrenheitTemp = sc.nextDouble(); celsiusTemp = CONVERSION_FACTOR * (fahrenheitTemp - BASE); System.out.println ("Celsius Equivalent: " + celsiusTemp); } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online