-
Notifications
You must be signed in to change notification settings - Fork 5
/
tools.js
67 lines (49 loc) · 1.45 KB
/
tools.js
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
var weightInPounds;
var weightInKilograms
var heightFeet;
var heightInches;
var heightInchesTotal
var age;
var gender;
age = 33;
weightInPounds = 157;
heightFeet = 5;
heightInches = 7;
gender = "female";
if (gender == "female") {
$('div #men-cal-display').hide();
} else {
$('div #men-cal-display').show();
$('div #women-cal-display').hide();
};
weightInKilograms = (weightInPounds / 2.2);
/*$('.weight-in-kilograms').html(weightInKilograms);*/
/*convert height to centimeters*/
feetToInches = (heightFeet * 12);
totalInches = (feetToInches + heightInches);
heightInCentimeters = (totalInches / 0.39370);
/*$('.height-inches-total').html(totalInches);
$('.height-cm-total').html(heightInCentimeters);*/
/*
Mifflin - St Jeor Formula
Men
10 x weight (kg) + 6.25 x height (cm) - 5 x age (y) + 5
Women
10 x weight (kg) + 6.25 x height (cm) - 5 x age (y) - 161.
*/
men = ((10 * weightInKilograms) + (6.25 * heightInCentimeters) - (5 * age) + 5);
women = ((10 * weightInKilograms) + (6.25 * heightInCentimeters) - (5 * age) - 161);
$('.cals-for-men').html(men.toFixed());
$('.cals-for-women').html(women.toFixed());
dailySugar = (men * .05)
angular.module('formExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.master = {};
$scope.update = function(user) {
$scope.master = angular.copy(user);
};
$scope.reset = function() {
$scope.user = angular.copy($scope.master);
};
$scope.reset();
}]);