Skip to content

Commit 05a6e4c

Browse files
committed
3.2
1 parent 86566d9 commit 05a6e4c

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

ch03/TempConvert.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
import java.util.Scanner;
3+
/**
4+
* Converts centimeters to feet and inches.
5+
*/
6+
public class TempConvert
7+
{
8+
9+
public static void main(String[] args) {
10+
double celsius;
11+
double fahrenheit;
12+
13+
Scanner in = new Scanner(System.in);
14+
15+
// prompt the user and get the value
16+
System.out.print("Exactly how many cm? ");
17+
celsius = in.nextDouble();
18+
19+
fahrenheit = (celsius * 9.0/5.0) + 32;
20+
System.out.println("Temp in Farenheight is: " + fahrenheit);
21+
22+
23+
24+
}
25+
26+
}
27+

0 commit comments

Comments
 (0)