-
Notifications
You must be signed in to change notification settings - Fork 4
/
Person.java
164 lines (126 loc) · 2.91 KB
/
Person.java
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
package model;
public class Person {
private static Person instance = new Person();
/*
* Keep track of users: age, height, weight
*/
private Goal currentGoal = new Goal("Maintain Weight", 1.0);
private Activity activityLevel = new Activity("Sedentary", 1.2);
private String firstName = "Hello";
private String lastName = "World";
private String units = "Metric";
private String gender = "Male";
private int age = 20;
private double weight = 70;
private double height = 183;
private double bodyfat = 19.0;
private double waist = 85;
private double BMI = 0;
private double BMR = 0;
private double TDEE = 0;
private double goalCalories;
/* Singleton class */
private Person() {
}
// static block initialization for exception handling
static {
try {
instance = new Person();
} catch (Exception e) {
throw new RuntimeException("Exception occured in creating singleton user instance");
}
}
public Activity getActivityLevel() {
return activityLevel;
}
public void setActivityLevel(Activity activityLevel) {
this.activityLevel = activityLevel;
}
public void setBodyfat(double bodyfat) {
this.bodyfat = bodyfat;
}
public void setWaist(double waist) {
this.waist = waist;
}
public void setTDEE(double value) {
this.TDEE = value;
}
public double getTDEE() {
return TDEE;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getGender() {
return gender;
}
public static Person getInstance() {
return instance;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
public void setGender(String newValue) {
this.gender = newValue;
}
public double getBodyfat() {
return bodyfat;
}
public double getWaist() {
return waist;
}
public double getGoalCalories() {
return goalCalories;
}
public void setGoalCalories(double value) {
this.goalCalories = value;
}
public Goal getCurrentGoal() {
return currentGoal;
}
public void setCurrentGoal(Goal currentGoal) {
this.currentGoal = currentGoal;
}
public String getUnits() {
return units;
}
public void setUnits(String units) {
this.units = units;
}
public double getBMR() {
return BMR;
}
public void setBMR(double bMR) {
BMR = bMR;
}
public double getBMI() {
return BMI;
}
public void setBMI(double bMI) {
BMI = bMI;
}
}