1
00:00:00,800 --> 00:00:06,560
Welcome back and this video, we are going to add the functionality for the BMI calculator and for now

2
00:00:06,560 --> 00:00:08,780
just one for the metric system.

3
00:00:08,780 --> 00:00:16,340
So you can see once I click on it, this window pops up so I can enter the weight and I weigh six to

4
00:00:16,340 --> 00:00:21,460
nine kilos and then the height in centimeters and I'm on sixty nine and then we can calculate it.

5
00:00:21,460 --> 00:00:24,050
Then you can see your BMI, so on, so normal.

6
00:00:24,050 --> 00:00:24,860
Congratulations.

7
00:00:24,860 --> 00:00:25,630
You're in good shape.

8
00:00:26,090 --> 00:00:26,510
All right.

9
00:00:26,540 --> 00:00:28,250
And that's what we're going to build this video.

10
00:00:28,260 --> 00:00:30,650
And of course you can go ahead and try to build that yourself.

11
00:00:30,890 --> 00:00:38,180
What you will need to have is of course the formula for BMI and which values mean what.

12
00:00:38,450 --> 00:00:43,280
But if you build everything else except for this specific functionality, then it's going to be fine

13
00:00:43,280 --> 00:00:44,360
already as well.

14
00:00:44,360 --> 00:00:51,380
You can, of course, Google how to calculate the BMI and what the different metrics are there and try

15
00:00:51,380 --> 00:00:52,910
to build everything yourself.

16
00:00:52,910 --> 00:00:55,030
But otherwise you can, of course, follow along.

17
00:00:55,250 --> 00:00:57,290
I still think that is a great exercise.

18
00:00:57,470 --> 00:01:00,800
So if you want to challenge yourself, please go ahead and build that.

19
00:01:01,370 --> 00:01:01,730
All right.

20
00:01:01,730 --> 00:01:04,069
Let's go ahead and build that UI first.

21
00:01:04,069 --> 00:01:08,880
So that's something that we, of course, need to do in our BMI X amount.

22
00:01:09,050 --> 00:01:16,160
So here activity underscore BMI, XML, and here I'm going to put that underneath my toolbar and I'm

23
00:01:16,160 --> 00:01:23,660
going to use a linear layout here so you can see we have a relative layout as the surrounding container,

24
00:01:23,660 --> 00:01:24,380
so to speak.

25
00:01:24,380 --> 00:01:29,870
And then inside of that, I have a linear layout and there is a lot going on there.

26
00:01:29,870 --> 00:01:36,740
So I'm just going to paste it in here and then I'm going to go through it because this is a lot of text

27
00:01:36,740 --> 00:01:38,690
that we need to use here.

28
00:01:39,360 --> 00:01:44,690
And when pasting the activity in here, you might get this problem here.

29
00:01:44,700 --> 00:01:50,780
This little arrow, it says, cannot resolve come that ad, so forth.

30
00:01:50,780 --> 00:01:57,410
And what we need to do is we need to use this comma, Google, that Android, the material, and add

31
00:01:57,410 --> 00:01:58,670
that to our build cradle.

32
00:01:58,680 --> 00:02:00,480
So the module app.

33
00:02:00,650 --> 00:02:04,760
So this one, we need to add a dependency in here.

34
00:02:05,180 --> 00:02:07,190
So implementation.

35
00:02:09,210 --> 00:02:15,690
And then apostrophe Google material and here colon material.

36
00:02:17,340 --> 00:02:18,000
Kolan.

37
00:02:19,230 --> 00:02:20,820
1.0 dot zero.

38
00:02:22,160 --> 00:02:27,250
All right, and then you need to sync it, and by the way, this is within the dependancy, so built

39
00:02:27,260 --> 00:02:29,650
a cradle and the app one.

40
00:02:29,660 --> 00:02:31,970
So there are two, as you can see, the project one at the app one.

41
00:02:32,210 --> 00:02:35,890
So the app one, you need to add that under dependency.

42
00:02:35,900 --> 00:02:37,820
So this line here implementation.

43
00:02:38,210 --> 00:02:43,290
Cool, that android, that material and then sync now and then you will be able to use it.

44
00:02:43,670 --> 00:02:47,150
This is something that is the case because we are only using empty activities.

45
00:02:47,150 --> 00:02:53,180
If we were using blank activities, then that would be a different story because then our basic activities,

46
00:02:53,390 --> 00:02:55,840
then this would be there automatically.

47
00:02:56,540 --> 00:03:01,550
OK, but now coming back to this line here, you can see now it's not a.

48
00:03:02,400 --> 00:03:03,420
Complaining anymore.

49
00:03:03,720 --> 00:03:09,060
So what we have is a linear layout, and I called this one the units view that's matching the parent,

50
00:03:09,070 --> 00:03:13,650
so it's taking the whole with height and it is underneath our toolbar.

51
00:03:14,430 --> 00:03:15,230
This one here.

52
00:03:15,450 --> 00:03:17,790
So our toolbar, BMI activity.

53
00:03:18,990 --> 00:03:19,830
Because we are.

54
00:03:25,280 --> 00:03:31,490
In a relative layout, and then we set the orientation to vertical, we have a little padding, and

55
00:03:31,490 --> 00:03:37,880
then I have this text input layout which has an idea I call the telemetric unit wait.

56
00:03:38,340 --> 00:03:42,500
Then we set a particular style and I set the style to outline box.

57
00:03:42,500 --> 00:03:46,570
But that allows us to do is to have this pretty cool style that you can see here.

58
00:03:46,580 --> 00:03:54,590
So we have this outline box and once I click on it, you can see now the hint or the predefined text

59
00:03:54,590 --> 00:03:57,420
goes up towards this line here.

60
00:03:57,440 --> 00:03:59,450
So this is a pretty cool interaction.

61
00:03:59,450 --> 00:04:04,470
And you get that by adding this text input layout and adding this particular style here.

62
00:04:04,940 --> 00:04:08,860
So I'm saying the width should match parent that the height should only be as much as required.

63
00:04:09,260 --> 00:04:12,500
And then in there I have this compact added text.

64
00:04:12,500 --> 00:04:15,460
So that's just the latest version of an edit text.

65
00:04:15,500 --> 00:04:20,329
I called it metric unit height weight and then match parent in with.

66
00:04:20,329 --> 00:04:26,150
So take the all with only as high as you require and then the hint should be weight in kilograms.

67
00:04:26,150 --> 00:04:31,160
So you can see that this is the hint that you can see here, which is pretty cool, and that's also

68
00:04:31,160 --> 00:04:32,780
what will be pushed towards the top.

69
00:04:32,780 --> 00:04:34,340
So that's something you can play around with.

70
00:04:34,340 --> 00:04:37,250
This value here will change what people will see there.

71
00:04:37,660 --> 00:04:39,970
Then the input type should be no decimal.

72
00:04:39,980 --> 00:04:45,890
So if you do that, then this keyboard comes up where you only can enter decimal values.

73
00:04:45,890 --> 00:04:51,080
You cannot enter any alphabetic values, but really just numeric once.

74
00:04:51,350 --> 00:04:53,570
And that's what we get with no decimal.

75
00:04:54,250 --> 00:04:56,510
All right, textiles, the 16 S.P..

76
00:04:56,840 --> 00:04:59,420
And then I have another text input layout, the same thing.

77
00:04:59,420 --> 00:05:06,180
I called this one till unit height and then it uses the same style.

78
00:05:06,200 --> 00:05:12,560
So this outline box style, all the values are the same except for the ID here.

79
00:05:12,560 --> 00:05:15,320
And a hint now is height in centimeters.

80
00:05:15,950 --> 00:05:24,080
OK, underneath it I have this a linear layout which is the display BMI result layouts or display BMI

81
00:05:24,080 --> 00:05:24,560
result.

82
00:05:24,920 --> 00:05:29,960
It should match parent in terms of with but it should prep its content in terms of height.

83
00:05:30,740 --> 00:05:32,510
Emergen top should be twenty five.

84
00:05:32,510 --> 00:05:35,270
So a little distance towards top vertical again.

85
00:05:35,270 --> 00:05:37,380
So stuff is put on top of each other.

86
00:05:37,400 --> 00:05:43,610
Visibility is such a visible so you might guess it's already we will change the visibility.

87
00:05:44,700 --> 00:05:48,270
We even said Tool's visibility too visible, so this is just for.

88
00:05:49,650 --> 00:05:56,610
Debugging and developing purposes, then we have this text you and another text to you and to more text

89
00:05:56,630 --> 00:05:56,840
use.

90
00:05:56,890 --> 00:06:00,060
And if we have this button, so let's look at those four text views.

91
00:06:00,300 --> 00:06:02,100
One is called TV, your BMI.

92
00:06:02,850 --> 00:06:07,800
Again, Metropia and Web content, growthy centered text this your BMI text.

93
00:06:07,800 --> 00:06:09,060
All CEPS is such a true.

94
00:06:09,070 --> 00:06:11,220
So all the text will be in capital letters.

95
00:06:11,550 --> 00:06:16,260
Visibility is said to invisible and then we have the text size to 16.

96
00:06:17,010 --> 00:06:18,700
Now the same thing for this one.

97
00:06:18,720 --> 00:06:25,410
So here the BMI value is said to match parent content.

98
00:06:25,410 --> 00:06:29,180
Margin is five density pixels with a little gravity.

99
00:06:29,430 --> 00:06:37,500
We have some text US settings here and the text itself in the tools just says 15, even though we're

100
00:06:37,500 --> 00:06:38,520
not using it like that.

101
00:06:38,550 --> 00:06:41,260
So Tool's is here what we can see here.

102
00:06:41,280 --> 00:06:43,240
So just did we see anything in there?

103
00:06:43,260 --> 00:06:43,590
Right.

104
00:06:43,870 --> 00:06:47,670
So basically these are the four text fields that I have there.

105
00:06:47,970 --> 00:06:53,730
And I want to let the user later know what his actual BMI is.

106
00:06:53,730 --> 00:06:56,880
And these are the four text fields or text views which do that.

107
00:06:57,310 --> 00:07:01,260
OK, so we have this text you, which is the TV, BMI type.

108
00:07:02,910 --> 00:07:11,250
And it's set centered to Texas normal, so are you overweight or are you normal, are you on the way

109
00:07:11,250 --> 00:07:12,030
to those kind of things?

110
00:07:12,040 --> 00:07:17,550
So this is going to be this text view and then the final text, you can see a little description.

111
00:07:17,560 --> 00:07:18,680
So are you fit?

112
00:07:18,690 --> 00:07:20,900
Are you healthy, in danger?

113
00:07:20,910 --> 00:07:25,990
So, you know, you need to really take care of your health and lose some weight or gain some weight.

114
00:07:26,010 --> 00:07:31,020
So this is the kind of text that will be instead of this text, you and then on the need that we have

115
00:07:31,020 --> 00:07:39,330
this button, which is called button calculate units, and it's going to be gravitating towards the

116
00:07:39,330 --> 00:07:39,840
bottom.

117
00:07:40,020 --> 00:07:42,950
The margin will be set to thirty five density pixels.

118
00:07:43,470 --> 00:07:47,370
We have a little background color here, which is our green background color.

119
00:07:47,370 --> 00:07:50,250
So it's basically this calculate button here.

120
00:07:51,500 --> 00:07:54,140
And then the next caller is said to White.

121
00:07:56,340 --> 00:07:58,540
All right, so that's the UI.

122
00:07:58,590 --> 00:08:01,490
Now let's go into the cutline coat.

123
00:08:01,800 --> 00:08:04,610
So here I'm going to create a new function.

124
00:08:04,620 --> 00:08:14,850
So inside of RBM I activity, I create this private function, private fun called validate metric units,

125
00:08:15,600 --> 00:08:18,210
and it's going to return a boolean.

126
00:08:18,660 --> 00:08:23,850
So the idea is that we want to check that the user enter something, correct or not.

127
00:08:24,150 --> 00:08:29,390
So I'm going to create a variable called is valid and I'm going to set that to true.

128
00:08:29,790 --> 00:08:38,370
So expecting that the entries that the user entered are true or are correct and valid and then I'm going

129
00:08:38,370 --> 00:08:39,700
to return is valid.

130
00:08:40,080 --> 00:08:43,830
Now, of course, I need to set Isabelita false at one point if it is false.

131
00:08:43,840 --> 00:08:48,990
So I'm going to say if the heat metric.

132
00:08:50,690 --> 00:08:51,500
United.

133
00:08:52,990 --> 00:08:58,090
And wait, so those two, I think it was the top one, so let's start with this one, the tech start

134
00:08:58,330 --> 00:09:01,070
to string is empty.

135
00:09:02,230 --> 00:09:06,700
So if it is empty, then said is valid.

136
00:09:08,050 --> 00:09:10,630
To false and else.

137
00:09:12,480 --> 00:09:13,950
If the.

138
00:09:14,850 --> 00:09:16,980
IT metric unit.

139
00:09:18,110 --> 00:09:20,930
Height in this case has.

140
00:09:22,480 --> 00:09:24,670
The same story, so text to string.

141
00:09:27,160 --> 00:09:33,850
Is empty, then also said is valid to false, so I guess I'm just checking.

142
00:09:34,240 --> 00:09:35,850
Is any of the two fields empty?

143
00:09:35,950 --> 00:09:41,200
Because if one of the two fields is empty, then I don't want the calculation to do anything.

144
00:09:41,210 --> 00:09:42,730
So the buttons shouldn't do anything.

145
00:09:42,750 --> 00:09:49,160
Or maybe we should inform the user about having to enter a valid entry in both fields.

146
00:09:49,840 --> 00:09:50,310
All right.

147
00:09:50,440 --> 00:09:57,100
The next thing we need to do is we need to add an on click listener for this calculate button.

148
00:09:58,450 --> 00:10:07,060
So in order to do so, we're going to go into our uncreate here because that's where we handle our unscrupulousness

149
00:10:07,420 --> 00:10:10,080
for our buttons on the highest level.

150
00:10:10,540 --> 00:10:13,690
And I'm going to say button calculate units.

151
00:10:13,690 --> 00:10:19,030
And that's, by the way, this button here calculate units to one at the very bottom.

152
00:10:19,060 --> 00:10:21,130
Of course, if that one is pressed.

153
00:10:21,130 --> 00:10:22,660
So set on Click Listener.

154
00:10:25,960 --> 00:10:33,250
Then I first want to check if the entries are correct, so if the user entered something useful, so

155
00:10:33,250 --> 00:10:39,690
in both fields there is a value in there and then I will store the highest value.

156
00:10:39,940 --> 00:10:42,100
So value, height, value.

157
00:10:43,380 --> 00:10:51,870
Here, height value is going to be of type float, and I'm going to say it's going to be metric height.

158
00:10:52,850 --> 00:10:53,660
Thought text.

159
00:10:56,220 --> 00:10:57,270
The two string.

160
00:10:59,460 --> 00:11:01,900
And then transform that into a float.

161
00:11:02,220 --> 00:11:03,160
Why can I do that?

162
00:11:03,630 --> 00:11:09,420
Well, I can do that because the entry itself can only be a number here, as you can see.

163
00:11:09,540 --> 00:11:11,640
OK, so now I can.

164
00:11:13,160 --> 00:11:16,400
Transform that or convert that string into a float.

165
00:11:17,060 --> 00:11:23,570
Now, here's what I also want to do, is I want to convert that into meters, so I'm going to divide

166
00:11:23,570 --> 00:11:25,130
that by one hundred.

167
00:11:26,700 --> 00:11:27,240
And then.

168
00:11:29,140 --> 00:11:39,220
I also need to have a value for the weight, so weight value is also going to be a floating value and

169
00:11:39,220 --> 00:11:41,620
it's going to use it metric.

170
00:11:42,920 --> 00:11:45,950
Wait, the text to string.

171
00:11:47,430 --> 00:11:48,090
To float.

172
00:11:49,330 --> 00:11:54,490
And here, I don't need to calculate through anything or divide by anything, and then we can calculate

173
00:11:54,520 --> 00:11:55,030
the BMI.

174
00:11:55,030 --> 00:11:56,920
So the BMI is very basic.

175
00:11:56,920 --> 00:12:00,340
It's just a weight divided by the height squared.

176
00:12:00,580 --> 00:12:07,060
So while BMI is equal to weight value, divided by.

177
00:12:08,640 --> 00:12:10,560
Heights multiplied with height.

178
00:12:13,500 --> 00:12:22,050
That's it, and now we can go ahead and display the BMI results about in order to do so, we need to.

179
00:12:23,390 --> 00:12:28,410
Create another function, because I don't want to do all of that code inside of our BMI activity.

180
00:12:29,000 --> 00:12:29,960
I would be too much.

181
00:12:29,990 --> 00:12:31,760
So let's create another method here.

182
00:12:32,670 --> 00:12:37,980
Which I'm going to call this place of private fund display.

183
00:12:38,990 --> 00:12:40,460
The result?

184
00:12:43,330 --> 00:12:48,190
And of course, it needs to have a float in here, so I'm going to call this one BMI, which is of type

185
00:12:48,190 --> 00:12:52,150
float, and then in here I need a label.

186
00:12:52,450 --> 00:13:02,560
So Volle will be am I a label which is going to be of type strength and a value which will be the BMI

187
00:13:02,560 --> 00:13:03,610
description.

188
00:13:04,730 --> 00:13:10,470
Also of type strength, and then what I will need is the comparison.

189
00:13:10,610 --> 00:13:15,110
So the thing is, I'm going to paste it in here because it's a lot of very.

190
00:13:15,980 --> 00:13:19,760
Boring, but let's look at it, so it's always comparing.

191
00:13:19,790 --> 00:13:23,480
So if this is a comparison and it goes all the way down there.

192
00:13:24,500 --> 00:13:27,920
OK, so I'm checking to be BMI.

193
00:13:28,870 --> 00:13:32,020
Compared to 15, less than zero.

194
00:13:34,060 --> 00:13:35,120
Or equals zero.

195
00:13:35,560 --> 00:13:43,030
So what does compared to the competitors value with the specified value for order return zero if this

196
00:13:43,030 --> 00:13:47,050
value is equal to the specified other value, a negative number?

197
00:13:49,810 --> 00:13:51,670
If it's less than the other.

198
00:13:52,700 --> 00:13:59,810
Or a positive number if it's greater than other, so we're comparing two values to each other, so we're

199
00:13:59,810 --> 00:14:01,100
comparing BMI now.

200
00:14:01,100 --> 00:14:04,990
So the value that was passed to us, we're comparing that to 15.

201
00:14:05,240 --> 00:14:10,790
If that's the case, it's going to set BMI level to very severely underweight BMI description will be

202
00:14:10,790 --> 00:14:11,010
obese.

203
00:14:11,060 --> 00:14:15,650
You really need to take better care of yourself, eat more, and then we compare it.

204
00:14:16,250 --> 00:14:18,200
Is it between 15 and 16?

205
00:14:18,200 --> 00:14:20,350
So that's what this code here does.

206
00:14:20,630 --> 00:14:24,560
And if that's the case, then we're going to ride severely underweight.

207
00:14:25,070 --> 00:14:27,810
Oops, you really need to take care of each other or of yourself.

208
00:14:28,040 --> 00:14:29,300
So the text is the same.

209
00:14:29,450 --> 00:14:33,320
But we are also, of course, going to write the BMI to him as well.

210
00:14:34,810 --> 00:14:40,000
But as you can see, the BMI label is actually changing, so this description is the same what the BMI

211
00:14:40,000 --> 00:14:41,140
label is a little different.

212
00:14:41,260 --> 00:14:45,030
I can't then we check is it between 16 and eighteen point five?

213
00:14:45,580 --> 00:14:48,580
If that's the case, then you are still underweight.

214
00:14:48,910 --> 00:14:54,190
Is it between eighteen point five and 25, then you are in a normal shape.

215
00:14:54,200 --> 00:14:55,630
Congratulations.

216
00:14:55,630 --> 00:14:56,680
You are in a normal shape.

217
00:14:57,070 --> 00:14:57,760
And then.

218
00:14:58,930 --> 00:15:02,560
We have between 25 and 30, then you're overweight.

219
00:15:04,070 --> 00:15:12,440
Between 30 and 20 or 35 here, you can see the Europese plus one moderately obese, oops, you really

220
00:15:12,440 --> 00:15:15,640
need to take care of yourself, work out more or maybe.

221
00:15:16,070 --> 00:15:18,170
And then we have this other statement here.

222
00:15:19,390 --> 00:15:27,000
Where we compare it, 35 to 40, so is it between 35 and 40 your BMI, then you are obese, class,

223
00:15:27,010 --> 00:15:29,030
too severely obese.

224
00:15:29,050 --> 00:15:36,790
And then if none of the beforehand is true, then you are severely or obese.

225
00:15:36,790 --> 00:15:44,110
Class three, very severely obese, and then you really need to act because that's it's really time.

226
00:15:44,140 --> 00:15:47,050
OK, so that's basically the whole thing here.

227
00:15:47,050 --> 00:15:48,740
You see, it's rather boring.

228
00:15:48,760 --> 00:15:54,180
So I hope you're full of forgive me for not entering everything or typing everything.

229
00:15:54,730 --> 00:16:01,150
So then the next thing that I want to do is I want to make all of those text fields visible, because

230
00:16:01,150 --> 00:16:02,830
if you look at the text fields again.

231
00:16:03,460 --> 00:16:04,180
So here.

232
00:16:05,680 --> 00:16:13,150
The text views actually the whole linear layout visibility is set to visible, but the text you hear

233
00:16:13,150 --> 00:16:14,290
is invisible.

234
00:16:15,280 --> 00:16:18,040
And actually, let me check the other text fields.

235
00:16:19,430 --> 00:16:21,660
They are set to visible, but they are never used.

236
00:16:22,490 --> 00:16:22,910
So.

237
00:16:23,830 --> 00:16:30,550
What we can do is we can make sure that they all are set to be invisible and we do that with these lines

238
00:16:30,550 --> 00:16:34,660
of code here and we need to import you in order to use this code.

239
00:16:34,660 --> 00:16:42,370
So you can see I'm using TV, your BMI visibility to visible BMI value to visible BMI type to visible

240
00:16:42,370 --> 00:16:45,010
and BMI description to visible.

241
00:16:46,340 --> 00:16:49,640
All right, now, the next thing I do is I calculate the BMI or.

242
00:16:52,380 --> 00:17:01,380
Now, the next thing I do is I round, so I have to tell you, BMI value, which takes in the BMI here

243
00:17:01,890 --> 00:17:03,270
and makes it a big decimal.

244
00:17:03,390 --> 00:17:10,829
So what that does is it is used to round the result value to two decimals after the decimal point.

245
00:17:11,040 --> 00:17:19,260
OK, so I'm setting the scale to two and I'm using the rounding mode how even and I make a string out

246
00:17:19,260 --> 00:17:19,440
of it.

247
00:17:19,450 --> 00:17:21,890
So this is what this line of code does.

248
00:17:21,900 --> 00:17:24,470
It looks complicated, but that's basically what it does.

249
00:17:24,810 --> 00:17:31,380
So big decimal, say, a decimal hour of the or takes our big decimal, then brings it into the right

250
00:17:31,380 --> 00:17:37,590
format, as we do here with setting the scale and rounding it and then making a string out of the whole

251
00:17:37,590 --> 00:17:37,980
thing.

252
00:17:38,490 --> 00:17:38,910
All right.

253
00:17:38,910 --> 00:17:44,100
And then the next thing is we need to set our text so we have multiple text.

254
00:17:44,100 --> 00:17:44,340
Right.

255
00:17:44,340 --> 00:17:49,260
So we have, for example, the TV, BMI value.

256
00:17:49,920 --> 00:17:53,610
We can set the text to be the BMI value.

257
00:17:54,390 --> 00:17:56,520
So we create this additional variable here.

258
00:17:57,390 --> 00:17:58,110
This one here.

259
00:17:58,990 --> 00:18:07,410
Then we have the other variables, which we haven't set yet, so I type the text should be said to be

260
00:18:07,430 --> 00:18:08,050
my label.

261
00:18:09,690 --> 00:18:16,930
And the TV, BMI description should be said to the BMI description.

262
00:18:17,250 --> 00:18:19,890
So at this point, you can see this code is not gray anymore.

263
00:18:19,890 --> 00:18:20,540
It's white now.

264
00:18:20,550 --> 00:18:22,660
So we are using it now.

265
00:18:23,310 --> 00:18:23,820
All right.

266
00:18:26,430 --> 00:18:34,650
Already, so now there's one less thing left to do, and that is to actually ever call this function

267
00:18:34,950 --> 00:18:39,350
that we just created, this display PMI result, and that is in here.

268
00:18:39,360 --> 00:18:45,560
So we pass in the BMI, which we just calculated based on the height and weight.

269
00:18:46,260 --> 00:18:51,420
And by the way, if the user didn't enter anything useful, then I'm just going to.

270
00:18:53,530 --> 00:19:01,060
Prayers and a toast here saying, please enter Veliz values and the length of the toast is short and

271
00:19:01,060 --> 00:19:03,520
then it should show this toast.

272
00:19:05,410 --> 00:19:12,760
All right, so this is the coat that we need in order to test it, so let's test it on our emulator.

273
00:19:14,850 --> 00:19:19,770
There we are, so BMI calculator, we can see Texas looking good.

274
00:19:20,010 --> 00:19:28,230
Let's set the weight now again to 69, the height to 169 and calculate and you can see your BMI twenty

275
00:19:28,230 --> 00:19:30,750
four point one six a.m. congratulations.

276
00:19:30,750 --> 00:19:31,560
You are in good shape.

277
00:19:31,770 --> 00:19:39,740
So you can see that here, twenty four point one six is what was created by this line here.

278
00:19:40,560 --> 00:19:47,250
So where we scale it to two, we rounded it off evenly and.

279
00:19:48,240 --> 00:19:52,350
That's pretty much it, because the calculation itself probably returns a different value.

280
00:19:53,940 --> 00:19:58,350
So I entered it in a calculator, and as you can see, this is the value that I get twenty four point

281
00:19:58,350 --> 00:20:00,780
one five eight eight, eight and so forth, super long value.

282
00:20:01,120 --> 00:20:02,910
That's not what you want to display to the user.

283
00:20:03,180 --> 00:20:08,460
You should always limited to a much shorter number that is still useful to the user.

284
00:20:09,120 --> 00:20:11,400
OK, so that's it for now.

285
00:20:12,320 --> 00:20:19,510
In the next two videos, we are going to do the same thing for the BMI calculation, for the US system,

286
00:20:19,520 --> 00:20:25,760
so with inches and pounds and all those kind of things, and we will, first of all, prepare that and

287
00:20:25,760 --> 00:20:27,530
then afterwards we will finalize it.

288
00:20:27,530 --> 00:20:30,020
So we're going to require two videos for that.

289
00:20:30,140 --> 00:20:31,400
So see you in the next video.

