-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCalculateStep.java
More file actions
42 lines (38 loc) · 1.09 KB
/
CalculateStep.java
File metadata and controls
42 lines (38 loc) · 1.09 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
/**
* Converts from height & gender to estimate of steps taken per km travelled.
* @author Sunshine Regiment
*/
package conversion;
public final class CalculateStep {
public CalculateStep() {
}
/**
* To calculate how many steps a person takes per km
* according to their height and gender.
*
* Based on the stride length(length of each step).
* Formula: Women .413 * height / Men .415 * height
*
* @param profile
* @return number of steps per km
*/
public static double step (BiometricProfile profile){
double step;
double stride_length;
double height = profile.getHeight();//convert from metres to centimetres
boolean gender = profile.getGender();
if (gender) {
stride_length = 0.413 * height;
//convert to km
stride_length /= 1000;
//System.out.println("stride_length: " + stride_length);
} else {
stride_length = 0.415 * height;
//convert to km
stride_length /= 1000;
//System.out.println("stride_length: " + stride_length);
}
step = 1/stride_length;
return step;
}
}