-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcalculateBMI
More file actions
90 lines (55 loc) · 2.65 KB
/
calculateBMI
File metadata and controls
90 lines (55 loc) · 2.65 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/* Name: Hailey Martin
* Description:
* This program will obtain input from the user, declare variables of different types, use variables to calculate body fat and display results.
*/
import java.util.Scanner;
public class MartinHaileyHW01 {
public static void main(String[] args) {
// TODO Auto-generated method stub
//takes in an input
Scanner input = new Scanner(System.in);
//print out the request for age
//System.out.print("Enter age in years: ");
//saves input in variable age
//double age = input.nextDouble();
//print out the request for height
System.out.print("Enter height in inches: ");
//saves input in variable
double height = input.nextDouble();
//print out the request for neck
System.out.print("Enter neck in inches: ");
//saves input in variable
double neck = input.nextDouble();
//prints out request for waist
System.out.print("Enter waist in inches: ");
//saves variable for waist
double waist = input.nextDouble();
//prints request for hip
System.out.print("Enter hip in inches: ");
//saves variable for hip
double hip = input.nextDouble();
//prints request for weight
System.out.print("Enter weight in lbs: ");
//saves variable for weight
double weight = input.nextDouble();
//variable that holds the equation to get army fat (calculator)
//This uses logarithmic math method
double armyFatWoman = 163.205 * Math.log10(waist + hip - neck)- 97.684* Math.log10(height)-78.387;
//variable that holds the equation for getting BMI (calculator)
double bodyMassIndex = weight / (height * height)* 703;
//prints the army fat for a woman base on user input and calculations
System.out.println("\nYour army body fat is: " + armyFatWoman);
//prints Army Fat Percent Table
System.out.println("Maximum Body Fat to Join Army \nAge Male Female");
System.out.println("---------------------------------------------------------");
System.out.println("17-20 24% 30% \n21-27 26% 32% \n28-39 28% 34% \n40&over 30% 36%\n");
//prints out the calculations of BMI based on user input
System.out.println("Your BMI is: " + bodyMassIndex);
//prints BMI Table
System.out.println("Recommended Body Weight \nBMI Weight Status");
System.out.println("------------------------------------------------------------");
System.out.println("Below 18.5 Underweight \n18.5-below 25 Healthy Weight \n25 - below 30 Overweihgt \nOver 30 Obese\n");
//this closes out the input
input.close();
}//end of main
}//end of class