forked from erenuygur/EfficientHouseJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ9.java
More file actions
31 lines (24 loc) · 1.02 KB
/
Q9.java
File metadata and controls
31 lines (24 loc) · 1.02 KB
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
package homeworks.chapter2;
/*
A simple rule to estimate your ideal body weight is to allow 110 pounds for the first 5
feet of height and 5 pounds for each additional inch. Write a program with a variable
for the height of a person in feet and another variable for the additional inches. Assume
the person is at least 5 feet tall. For example, a person that is 6 feet and 3 inches tall
would be represented with a variable that stores the number 6 and another variable that
stores the number 3. Based on these values, calculate and output the ideal body weight.
*/
public class Q9 {
public static void main(String[] args) {
java.util.Scanner kb = new java.util.Scanner(System.in);
System.out.println("Feet: ");
int feet = kb.nextInt();
System.out.println("Inch: ");
int inch = kb.nextInt();
System.out.println("Pound: ");
int pound = kb.nextInt();
feet -= 5;
inch = inch + (feet * 12);
pound = pound + (inch * 5);
System.out.println(pound);
}
}