Difference between revisions of "Temperature Calculator"
From CompSciWiki
Line 1: | Line 1: | ||
{{1010PrAD | {{1010PrAD | ||
− | |ProblemName= | + | |ProblemName=Temperature Calculator |
+ | |||
+ | |Problem=Write a Java program Temp, that converts celcius to fahrenheit or vice versa.<br/>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 | ||
+ | <br/> | ||
+ | Example: User inputs "c" and "10" would result in "50f" | ||
+ | <br/> | ||
+ | <br/> | ||
+ | |||
+ | Use the following formula to convert your units<br/> | ||
+ | |||
+ | F = 9C/5 + 32 | ||
− | |||
|SolutionCode=public class HelloWorld | |SolutionCode=public class HelloWorld |
Revision as of 12:35, 1 April 2010
Back to the Program-A-Day homepage
ProblemWrite a Java program Temp, that converts celcius to fahrenheit or vice versa.
Use the following formula to convert your units F = 9C/5 + 32 |
...by students
An image or By Students section | |
---|---|---|
SolutionThe solution... | ||
Code |