-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaloriecounter.java
More file actions
48 lines (48 loc) · 1.17 KB
/
caloriecounter.java
File metadata and controls
48 lines (48 loc) · 1.17 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
public class caloriecounter{
public static void main(String args[]){
//System.out.println(args[0]);
String gender = args[0];
//System.out.println(gender);
int height = Integer.parseInt(args[1]);
int weight = Integer.parseInt(args[2]);
int age = Integer.parseInt(args[3]);
String activity = args[4];
double act = 0.0;
double EER = 0.0;
double BMI = 0.0;
if (gender.toUpperCase() == "MALE"){
if (activity.toUpperCase() == "SEDENTARY"){
act = 1;
}
else if (activity.toUpperCase() == "LOW ACTIVITY"){
act = 1.11;
}
else if (activity.toUpperCase() == "ACTIVITY"){
act = 1.26;
}
else {
act = 1.48;
}
EER = (662-(9.53*age)+(act*15.91*weight)+(5.396*height));
BMI = (weight/(height*height*0.0001));
}
else{
if (activity.toUpperCase() == "SEDENTARY"){
act = 1;
}
else if (activity.toUpperCase() == "LOW ACTIVITY"){
act = 1.12;
}
else if (activity.toUpperCase() == "ACTIVITY"){
act = 1.27;
}
else {
act = 1.45;
}
EER = (354-(6.91*age)+( act*9.36*weight )+(7.26*height));
BMI = (weight/(height*height*0.0001));
}
System.out.println(EER);
System.out.println(BMI);
}
}