1
00:00:00,240 --> 00:00:04,700
So that actually create another method in slight is Paxi manager class.

2
00:00:04,740 --> 00:00:10,800
So just I've been here public the access modifier of this method is going to be public the return type

3
00:00:10,800 --> 00:00:20,490
of this if it is strong the name of this method is going to be return the time left to get to destination

4
00:00:20,490 --> 00:00:22,590
location destination location.

5
00:00:22,590 --> 00:00:29,090
And this is going to accept a parameter of type location which is going to be Cullens location right.

6
00:00:29,100 --> 00:00:29,830
Come on.

7
00:00:29,880 --> 00:00:36,240
So the second parameter is going to be of type float and the name of this valuable the name of this

8
00:00:36,250 --> 00:00:42,180
privater is going to be miles per hour miles per hour.

9
00:00:42,210 --> 00:00:47,550
So let's actually create another parameter for the Smurfette which is going to be off that integer and

10
00:00:47,550 --> 00:00:51,400
the name of this parameter is going to be meters per mile.

11
00:00:51,470 --> 00:00:56,080
Let's actually open and close this method by using these curly braces and opening curly brace followed

12
00:00:56,080 --> 00:01:00,930
by a closing Korea-U.S. leading actually just create a new line here so that you can see the entire

13
00:01:00,940 --> 00:01:06,460
Mefford the name of this if it is returned the time left to get to destination location.

14
00:01:06,460 --> 00:01:09,630
So this method accepts free actually parameters.

15
00:01:09,760 --> 00:01:13,550
The first one is this one kind of location which is of the application.

16
00:01:13,570 --> 00:01:17,380
The second parameter is this one miles per hour which is off the float.

17
00:01:17,620 --> 00:01:21,190
And the third parameter is this 1 meters per mile.

18
00:01:21,370 --> 00:01:21,890
OK.

19
00:01:22,060 --> 00:01:27,740
So let's actually go inside this actually Meffert And let's see what's going on here inside the Smurfette.

20
00:01:27,760 --> 00:01:34,290
Let's create a variable of type float and the name of this method is going to be distance in meters.

21
00:01:34,300 --> 00:01:39,820
So it was an assignment operator here and then I can just refer to the name of this MF'er the the distance

22
00:01:40,270 --> 00:01:44,130
to this destination location actually in meters right.

23
00:01:44,290 --> 00:01:49,870
And I just need to pass the current location to the Smurfit semi-colon so it can actually return a float

24
00:01:49,870 --> 00:01:54,790
value and that floats about you is going to be the distance to destination location in meters.

25
00:01:54,850 --> 00:01:57,060
So that's vallire at this valuable here.

26
00:01:57,070 --> 00:02:01,290
The float distance in meters it's going to hold that value right.

27
00:02:01,570 --> 00:02:07,800
So now let me actually create a new line here so that you can see the entire Meffert here.

28
00:02:07,820 --> 00:02:11,590
Now let's actually create another variable of type float.

29
00:02:11,620 --> 00:02:18,020
So here the name of this rally is going to be time left assignment operator.

30
00:02:18,100 --> 00:02:24,310
I can refer to this distance in meters variable of type float in order to get this value so distance

31
00:02:24,310 --> 00:02:26,370
in meters divided by.

32
00:02:26,370 --> 00:02:31,230
So let's actually put a pair of practice's because I want to use the practices in order to have the

33
00:02:31,240 --> 00:02:37,000
higher precedence here because he wants the operation inside Apprentice's to execute first and then

34
00:02:37,030 --> 00:02:39,420
you want to actually divide that value by disvalue.

35
00:02:39,580 --> 00:02:48,340
So insider Apprentice's I can say actually this I can refer to this Miles per Hour miles per hour multiplied

36
00:02:48,520 --> 00:02:51,650
by meters per mile semi-colon.

37
00:02:51,670 --> 00:02:56,490
So they multiplied this value mph by this one meters per mile.

38
00:02:56,830 --> 00:02:59,680
And here we have this distance in meters here right.

39
00:02:59,680 --> 00:03:06,680
So this value is going to be divided by the result of this operation inside Apprentice's light.

40
00:03:06,880 --> 00:03:14,170
And the result here is going to be assigned to this time variable which is going to specified the time

41
00:03:14,260 --> 00:03:19,690
that is actually left in order to get to the destination location in order to actually get from the

42
00:03:19,690 --> 00:03:21,930
current location to destination location.

43
00:03:22,060 --> 00:03:25,990
This valuable time left is going to hold that value at that time.

44
00:03:26,350 --> 00:03:28,810
So now that we have this time left here.

45
00:03:28,810 --> 00:03:29,400
So.

46
00:03:29,500 --> 00:03:31,580
So not just that this is actually a formula.

47
00:03:31,580 --> 00:03:31,950
Okay.

48
00:03:32,050 --> 00:03:35,190
You can use this formula when really you want.

49
00:03:35,300 --> 00:03:41,740
OK you don't have to know about mathematics in order to actually create such applications right.

50
00:03:41,770 --> 00:03:45,780
You just need to know the formula and everything is done automatically for you.

51
00:03:45,850 --> 00:03:52,220
So just use that formula and use these variables in order to actually pass data around.

52
00:03:52,480 --> 00:03:56,370
And then your application is actually created for you.

53
00:03:56,590 --> 00:04:00,630
So let's actually put the other codes here after this line of code.

54
00:04:00,640 --> 00:04:01,210
I can't say.

55
00:04:01,300 --> 00:04:06,760
So I can actually create a variable of type string here and the name of this variable is going to be

56
00:04:06,970 --> 00:04:08,760
actually time resolved.

57
00:04:08,830 --> 00:04:10,990
Time result.

58
00:04:11,140 --> 00:04:16,990
And initially because this is going to be a local variable we must initialises right any way to assign

59
00:04:17,080 --> 00:04:19,180
an interesting value to the value of it.

60
00:04:19,180 --> 00:04:24,850
So here let me tell you that this valuable time lift is actually time left in our heads.

61
00:04:24,890 --> 00:04:25,250
Right.

62
00:04:25,360 --> 00:04:27,770
But because this is actually a float value.

63
00:04:27,970 --> 00:04:33,430
Let's actually first convert it to an integer value and then we have the hour it is that is actually

64
00:04:33,430 --> 00:04:35,430
the time to get to the destination location.

65
00:04:35,530 --> 00:04:40,990
So here is create a variable of that be integer and the name of this variable is going to be time left

66
00:04:41,440 --> 00:04:45,640
time left in our like assignment operator.

67
00:04:45,700 --> 00:04:50,740
So we need to cast this value to an integer value int and I can just refer to this time left variable

68
00:04:50,740 --> 00:04:52,860
which is of type float semicolon.

69
00:04:52,900 --> 00:04:59,140
So now here you are actually casting the value of this time the value which is of the float to an integer

70
00:04:59,140 --> 00:05:00,090
value.

71
00:05:00,370 --> 00:05:05,060
And then we are assigning that integer value to this valuable time left in ours.

72
00:05:05,200 --> 00:05:05,770
Right.

73
00:05:05,950 --> 00:05:15,400
So now I can actually say so lets create an if statement so if pine left in our heads is equal to 1

74
00:05:15,790 --> 00:05:18,770
if there is only 1 hour to get to the destination location.

75
00:05:18,890 --> 00:05:26,950
Okay in that case we are going to say result is going to be time without actually time result is going

76
00:05:26,950 --> 00:05:32,050
to be assignment operator time result plus.

77
00:05:32,470 --> 00:05:38,210
And I cant put two coats here and I can say one hour OK.

78
00:05:38,330 --> 00:05:43,200
And then I put a space at the end because I want to put Actually the minutes after the hour.

79
00:05:43,200 --> 00:05:46,270
So I put a space at the end of this I should be seeing value.

80
00:05:46,320 --> 00:05:52,980
So just put a semicolon here if there is only one hour where between the current location and the destination

81
00:05:52,980 --> 00:05:57,990
location that is then is actually right in that case we are going to just concatenate one hour or two

82
00:05:57,990 --> 00:06:01,700
this time result which is actually an empty an an empty string value.

83
00:06:01,860 --> 00:06:10,050
So let's create an ELSE IF statement here so Ill see if I insert a prentices I can say time left in

84
00:06:10,080 --> 00:06:13,400
hours is actually greater than 1.

85
00:06:13,530 --> 00:06:14,650
In that case.

86
00:06:14,670 --> 00:06:21,080
So first let me tell you that here this time result this syntax could be actually different.

87
00:06:21,090 --> 00:06:24,720
Instead of just writing this line of code that makes you comment out of this line of code and here I

88
00:06:24,720 --> 00:06:27,100
can say Time result.

89
00:06:27,810 --> 00:06:30,570
Time is on plus assignment operator.

90
00:06:30,810 --> 00:06:35,910
Actually have one hour I can say one hour right.

91
00:06:35,940 --> 00:06:39,160
This syntax is actually the same as the syntax here.

92
00:06:39,270 --> 00:06:39,700
OK.

93
00:06:39,870 --> 00:06:41,720
You can use either of them.

94
00:06:41,760 --> 00:06:43,940
So let's actually go inside these LCF statement.

95
00:06:43,950 --> 00:06:48,360
And here I can say Time result plus assignment operator.

96
00:06:48,690 --> 00:06:55,710
And here I can just refer to this time left in our word as valuable plus and that I can put two quotes

97
00:06:55,710 --> 00:07:02,130
here and here I can put a space and then I can say hours and then an address space and at the end because

98
00:07:02,250 --> 00:07:06,910
I told you I want to put the minutes after the hour is semicolon right.

99
00:07:06,960 --> 00:07:13,140
So here we are we are going to get the time left in our last year plus the hours and we are going to

100
00:07:13,140 --> 00:07:15,480
assign that value to this time result.

101
00:07:15,480 --> 00:07:18,580
So let me actually also show you the other syntax.

102
00:07:18,580 --> 00:07:21,330
Let me put another let me actually comment out this line of code.

103
00:07:21,330 --> 00:07:26,120
I could have right this line of code as this one I could have said time result.

104
00:07:26,370 --> 00:07:32,140
Assignment operator time result plus time left in hours plus.

105
00:07:32,280 --> 00:07:36,050
And then I put 2 coats hours space semicolon.

106
00:07:36,180 --> 00:07:37,270
That's it right.

107
00:07:37,380 --> 00:07:38,510
This line of code here.

108
00:07:38,530 --> 00:07:41,380
This syntax is exactly the same as this one.

109
00:07:41,470 --> 00:07:44,920
You can actually do the same thing but the syntax is actually different.

110
00:07:44,940 --> 00:07:48,530
So now that we have the hour it is let's get the minutes.

111
00:07:48,600 --> 00:07:49,360
OK.

112
00:07:49,710 --> 00:07:55,290
So let's after the ending curly brace of this statement and before the end in curly brace of the Smurfette

113
00:07:55,380 --> 00:08:03,000
here I am going to get the minutes so that data type of this radio is going to be integer minutes left

114
00:08:03,650 --> 00:08:03,970
right.

115
00:08:03,990 --> 00:08:05,070
Assignment operator.

116
00:08:05,100 --> 00:08:09,770
So first let me actually show you the formula in order to get them in it's actually left right.

117
00:08:09,960 --> 00:08:13,400
So I put a pair of pants this year in order to get the minutes.

118
00:08:13,440 --> 00:08:21,390
We must first actually minus the value of them actually time left variable.

119
00:08:21,420 --> 00:08:24,550
So I can say time left which is a flawed right.

120
00:08:24,570 --> 00:08:29,250
If I actually show you this variable you can see that this value this value the stuff that floats.

121
00:08:29,770 --> 00:08:33,170
And here I can see time left minus.

122
00:08:33,230 --> 00:08:37,220
So we have this time left in our list which is of type integer right.

123
00:08:37,250 --> 00:08:43,010
These two values are actually the same but this one is actually a float value which has a decimal value

124
00:08:43,010 --> 00:08:43,680
also.

125
00:08:43,970 --> 00:08:47,430
But this one this time of ours doesn't have a decimal value.

126
00:08:47,540 --> 00:08:54,840
So the formula is this time left which is the float value minus time left in our list.

127
00:08:55,220 --> 00:08:55,940
OK.

128
00:08:56,360 --> 00:09:00,790
And then here I just need to multiply the result of this operation by 60.

129
00:09:00,860 --> 00:09:06,400
So that actually puts the entire expression in inside the actor to Apprentice's.

130
00:09:06,440 --> 00:09:10,440
So first it's going to execute this operation here inside the apprentice's.

131
00:09:10,520 --> 00:09:11,030
OK.

132
00:09:11,210 --> 00:09:16,540
And that the result of this operation is going to be multiplied by disvalue 6 the semicolon.

133
00:09:16,850 --> 00:09:23,060
This is actually the formula in order to get the minutes that actually is left in order to get to the

134
00:09:23,060 --> 00:09:25,040
location to the destination location.

135
00:09:25,040 --> 00:09:27,920
So here we have an error or the is of type integer.

136
00:09:27,940 --> 00:09:30,680
But the result of this operation is going to be off like floats.

137
00:09:30,830 --> 00:09:34,340
So we must actually cast this value to an integer value.

138
00:09:34,430 --> 00:09:39,470
So here after the assignment operator I just put a set of practices and inside the Prentice's I can

139
00:09:39,470 --> 00:09:40,370
say it.

140
00:09:40,410 --> 00:09:45,130
So it's going to actually cast this value to an integer value and the decimal value is going to be element

141
00:09:45,730 --> 00:09:51,330
eliminated that decimal points the values the number after the decimal point is going to be eliminated.

142
00:09:51,470 --> 00:09:56,990
And the result is going to be assigned to these minutes left minutes left valuable of time integer.

143
00:09:57,080 --> 00:10:01,610
So now that we have two minutes left variable Let's see how we can use it.

144
00:10:01,610 --> 00:10:10,700
So here I can create an if statement if minutes left is equal to one here I can actually open and close

145
00:10:10,700 --> 00:10:16,730
this Satan by using these curly braces so I can get the value the current value of this type result

146
00:10:17,300 --> 00:10:20,070
which currently has the value of the hour right.

147
00:10:20,150 --> 00:10:21,070
Time result.

148
00:10:21,230 --> 00:10:25,790
Assignment operator time result plus two coats.

149
00:10:25,920 --> 00:10:33,180
And here I can actually say one minutes right semi-colon.

150
00:10:33,420 --> 00:10:38,940
So that's why we actually provided spaces here for this hour's string value.

151
00:10:38,950 --> 00:10:40,900
Here is a line number of 76.

152
00:10:40,950 --> 00:10:45,130
You can see that here because I want to actually put the minutes after the hour.

153
00:10:45,210 --> 00:10:50,040
So here we have one minute here so I could have used actually the other syntax.

154
00:10:50,040 --> 00:10:54,570
Let me actually comment out this line of code in order to show you another syntax here.

155
00:10:54,690 --> 00:11:04,890
So I can say Time result plus assignment operator and I can put two quotes here one minute right semicolon.

156
00:11:04,940 --> 00:11:08,380
So let's create an elusive statement for this if statement.

157
00:11:08,390 --> 00:11:11,690
So after the end in curly brace of this statement I can't say.

158
00:11:11,690 --> 00:11:12,750
Else if.

159
00:11:12,770 --> 00:11:13,600
Else.

160
00:11:14,140 --> 00:11:21,800
And inside the parenthesis I can see LCF minutes left is actually greater than 1.

161
00:11:21,890 --> 00:11:25,370
So in that case we are going to say Time result.

162
00:11:25,400 --> 00:11:28,940
Assignment operator time result plus.

163
00:11:28,940 --> 00:11:37,010
So we get the minutes left minutes left on here I can put a plug concatenation operator.

164
00:11:37,020 --> 00:11:39,540
This is the plus OPERATOR Two coats.

165
00:11:39,540 --> 00:11:41,960
I can't say actually I can't put a space here.

166
00:11:42,000 --> 00:11:44,130
I can say minutes semi-colon.

167
00:11:44,400 --> 00:11:45,740
Let me show you the other syntax.

168
00:11:45,750 --> 00:11:52,920
Let me comment on this line of code and here I can say Time result time result plus assignment operator

169
00:11:53,700 --> 00:11:59,420
actually minutes left minutes left plus and two coats I put space here.

170
00:11:59,430 --> 00:12:01,300
And then I can say minutes semi-colon.

171
00:12:01,410 --> 00:12:07,290
So here after the end in curly brace of this LCF statement and before the end in curly brace of this

172
00:12:07,290 --> 00:12:09,700
method here let's actually create an if statement.

173
00:12:09,700 --> 00:12:16,950
The final statement of this method I can't say enough time left in our test is actually less than or

174
00:12:17,010 --> 00:12:24,480
equal to zero and that I put D and the logical operator here and I can't say minutes left is less than

175
00:12:24,510 --> 00:12:25,650
or equal to zero.

176
00:12:25,650 --> 00:12:36,240
So in that case we are going to just say Time result assignment operator and I can't see less than less

177
00:12:36,300 --> 00:12:37,480
than a minute.

178
00:12:39,000 --> 00:12:45,360
Is left to get to the destination location destination location.

179
00:12:45,420 --> 00:12:46,920
Right semicolon.

180
00:12:47,310 --> 00:12:52,900
And finally here if you specify that this McFate must return a value of type string.

181
00:12:52,920 --> 00:12:55,520
So we are going to return the time result.

182
00:12:55,710 --> 00:12:59,430
So return time does not semicolon.

183
00:12:59,640 --> 00:13:00,870
That's it.

184
00:13:00,870 --> 00:13:04,620
This is actually how we implemented our taxi manager class.

185
00:13:04,620 --> 00:13:07,870
Right now it's time to go to the main activity class.

186
00:13:08,070 --> 00:13:10,600
We're going to continue building this application in the next tutorial.

187
00:13:10,620 --> 00:13:11,790
Thank you very much for watching.

188
00:13:11,790 --> 00:13:13,200
And I've seen the next story.

