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 {
88 public static void main (String [] args ) {
99 double cm ;
1010 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 ;
1213 Scanner in = new Scanner (System .in );
1314
1415 // prompt the user and get the value
1516 System .out .print ("Exactly how many cm? " );
1617 cm = in .nextDouble ();
1718
1819 // 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 ;
2223 System .out .printf ("%.2f cm = %d ft, %d in\n " ,
2324 cm , feet , remainder );
2425 }
You can’t perform that action at this time.
0 commit comments