File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -8,17 +8,18 @@ public class Convert {
8
8
public static void main (String [] args ) {
9
9
double cm ;
10
10
int feet , inches , remainder ;
11
- final double centPerInch = 2.54 ;
11
+ final double CM_PER_INCH = 2.54 ;
12
+ final int IN_PER_FOOT = 12 ;
12
13
Scanner in = new Scanner (System .in );
13
14
14
15
// prompt the user and get the value
15
16
System .out .print ("Exactly how many cm? " );
16
17
cm = in .nextDouble ();
17
18
18
19
// convert and output the result
19
- inches = (int ) (cm / centPerInch );
20
- feet = inches / 12 ;
21
- remainder = inches % 12 ;
20
+ inches = (int ) (cm / CM_PER_INCH );
21
+ feet = inches / IN_PER_FOOT ;
22
+ remainder = inches % IN_PER_FOOT ;
22
23
System .out .printf ("%.2f cm = %d ft, %d in\n " ,
23
24
cm , feet , remainder );
24
25
}
You can’t perform that action at this time.
0 commit comments