Temperature Calculator

From CompSciWiki
Revision as of 12:35, 1 April 2010 by HenryK (Talk | contribs)

Jump to: navigation, search

Back to the Program-A-Day homepage

Problem

Write a Java program Temp, that converts celcius to fahrenheit or vice versa.
The program should:

  • prompt the user for a 1-character string c (celcius) or f (fahrenheit) that tells the program which unit you are entering
  • prompt the user for the temperature as an integer (2-digits max)
  • output the solution followed by a c or f to note the final unit


Example: User inputs "c" and "10" would result in "50f"

Use the following formula to convert your units

F = 9C/5 + 32

 

...by students

float
Taken from http://www.flickr.com/photos/daniello/565304023/

An image or By Students section

Solution

The solution...

Code

Solution Code

Back to the Program-A-Day homepage