forked from txs72/JavaTutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBMI.java
More file actions
executable file
·61 lines (59 loc) · 1.77 KB
/
BMI.java
File metadata and controls
executable file
·61 lines (59 loc) · 1.77 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* */ package ch10;
/* */
/* */ public class BMI {
/* */ private String name;
/* */ private int age;
/* */ private double weight;
/* */ private double height;
/* */ public static final double KILOGRAMS_PER_POUND = 0.45359237D;
/* */ public static final double METERS_PER_INCH = 0.0254D;
/* */
/* */ public BMI(String name, int age, double weight, double height) {
/* 12 */ this.name = name;
/* 13 */ this.age = age;
/* 14 */ this.weight = weight;
/* 15 */ this.height = height;
/* */ }
/* */
/* */ public BMI(String name, double weight, double height) {
/* 19 */ this(name, 20, weight, height);
/* */ }
/* */
/* */ public double getBMI() {
/* 23 */ double bmi = this.weight * 0.45359237D / this.height * 0.0254D * this.height * 0.0254D;
/* */
/* 25 */ return Math.round(bmi * 100.0D) / 100.0D;
/* */ }
/* */
/* */ public String getStatus() {
/* 29 */ double bmi = getBMI();
/* 30 */ if (bmi < 18.5D)
/* 31 */ return "Underweight";
/* 32 */ if (bmi < 25.0D)
/* 33 */ return "Normal";
/* 34 */ if (bmi < 30.0D) {
/* 35 */ return "Overweight";
/* */ }
/* 37 */ return "Obese";
/* */ }
/* */
/* */ public String getName() {
/* 41 */ return this.name;
/* */ }
/* */
/* */ public int getAge() {
/* 45 */ return this.age;
/* */ }
/* */
/* */ public double getWeight() {
/* 49 */ return this.weight;
/* */ }
/* */
/* */ public double getHeight() {
/* 53 */ return this.height;
/* */ }
/* */ }
/* Location: /Volumes/TXS.128G/hope useful/practice/2020.jar!/ch10/BMI.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.1.3
*/