-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConversion.java
More file actions
34 lines (28 loc) · 1008 Bytes
/
Copy pathConversion.java
File metadata and controls
34 lines (28 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import java.util.*;
public class Conversion
{
static Scanner console = new Scanner(System.in);
static final double CENTIMETERS_PER_INCH = 2.54;
static final int INCHES_PER_FOOT = 12;
public static void main(String[] args)
{
//declare variables
int feet;
int inches;
int totalInches;
double centimeters;
System.out.print("Enter feet: ");
feet = console.nextInt();
System.out.println();
System.out.print("Enter inches: ");
inches = console.nextInt();
System.out.println();
System.out.println("The numbers you entered are "
+ feet + " for feet and " + inches + " for inches.");
totalInches = INCHES_PER_FOOT * feet + inches;
System.out.println();
System.out.println("The total number of inches = " + totalInches);
centimeters = totalInches * CENTIMETERS_PER_INCH;
System.out.println("The number of centimeters = " + centimeters);
}
}