TempConverter

TempConverter - -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
//******************************************************************** // TempConverter.java Author: Lewis/Loftus // // Demonstrates the use of primitive data types and arithmetic // expressions. //******************************************************************** / public class TempConverter { //----------------------------------------------------------------- // Computes the Fahrenheit equivalent of a specific Celsius // value using the formula F = (9/5)C + 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 = 9.0 / 5.0; double fahrenheitTemp; int celsiusTemp = 24; // value to convert fahrenheitTemp = celsiusTemp * CONVERSION_FACTOR + BASE; System.out.println ("Celsius Temperature: " + celsiusTemp); System.out.println ("Fahrenheit Equivalent: " + fahrenheitTemp); } }...
View Full Document

This document was uploaded on 02/21/2011.

Ask a homework question - tutors are online