So that actually create another method in slight is Paxi manager class.
So just I've been here public the access modifier of this method is going to be public the return type
of this if it is strong the name of this method is going to be return the time left to get to destination
location destination location.
And this is going to accept a parameter of type location which is going to be Cullens location right.
Come on.
So the second parameter is going to be of type float and the name of this valuable the name of this
privater is going to be miles per hour miles per hour.
So let's actually create another parameter for the Smurfette which is going to be off that integer and
the name of this parameter is going to be meters per mile.
Let's actually open and close this method by using these curly braces and opening curly brace followed
by a closing Korea-U.S. leading actually just create a new line here so that you can see the entire
Mefford the name of this if it is returned the time left to get to destination location.
So this method accepts free actually parameters.
The first one is this one kind of location which is of the application.
The second parameter is this one miles per hour which is off the float.
And the third parameter is this 1 meters per mile.
OK.
So let's actually go inside this actually Meffert And let's see what's going on here inside the Smurfette.
Let's create a variable of type float and the name of this method is going to be distance in meters.
So it was an assignment operator here and then I can just refer to the name of this MF'er the the distance
to this destination location actually in meters right.
And I just need to pass the current location to the Smurfit semi-colon so it can actually return a float
value and that floats about you is going to be the distance to destination location in meters.
So that's vallire at this valuable here.
The float distance in meters it's going to hold that value right.
So now let me actually create a new line here so that you can see the entire Meffert here.
Now let's actually create another variable of type float.
So here the name of this rally is going to be time left assignment operator.
I can refer to this distance in meters variable of type float in order to get this value so distance
in meters divided by.
So let's actually put a pair of practice's because I want to use the practices in order to have the
higher precedence here because he wants the operation inside Apprentice's to execute first and then
you want to actually divide that value by disvalue.
So insider Apprentice's I can say actually this I can refer to this Miles per Hour miles per hour multiplied
by meters per mile semi-colon.
So they multiplied this value mph by this one meters per mile.
And here we have this distance in meters here right.
So this value is going to be divided by the result of this operation inside Apprentice's light.
And the result here is going to be assigned to this time variable which is going to specified the time
that is actually left in order to get to the destination location in order to actually get from the
current location to destination location.
This valuable time left is going to hold that value at that time.
So now that we have this time left here.
So.
So not just that this is actually a formula.
Okay.
You can use this formula when really you want.
OK you don't have to know about mathematics in order to actually create such applications right.
You just need to know the formula and everything is done automatically for you.
So just use that formula and use these variables in order to actually pass data around.
And then your application is actually created for you.
So let's actually put the other codes here after this line of code.
I can't say.
So I can actually create a variable of type string here and the name of this variable is going to be
actually time resolved.
Time result.
And initially because this is going to be a local variable we must initialises right any way to assign
an interesting value to the value of it.
So here let me tell you that this valuable time lift is actually time left in our heads.
Right.
But because this is actually a float value.
Let's actually first convert it to an integer value and then we have the hour it is that is actually
the time to get to the destination location.
So here is create a variable of that be integer and the name of this variable is going to be time left
time left in our like assignment operator.
So we need to cast this value to an integer value int and I can just refer to this time left variable
which is of type float semicolon.
So now here you are actually casting the value of this time the value which is of the float to an integer
value.
And then we are assigning that integer value to this valuable time left in ours.
Right.
So now I can actually say so lets create an if statement so if pine left in our heads is equal to 1
if there is only 1 hour to get to the destination location.
Okay in that case we are going to say result is going to be time without actually time result is going
to be assignment operator time result plus.
And I cant put two coats here and I can say one hour OK.
And then I put a space at the end because I want to put Actually the minutes after the hour.
So I put a space at the end of this I should be seeing value.
So just put a semicolon here if there is only one hour where between the current location and the destination
location that is then is actually right in that case we are going to just concatenate one hour or two
this time result which is actually an empty an an empty string value.
So let's create an ELSE IF statement here so Ill see if I insert a prentices I can say time left in
hours is actually greater than 1.
In that case.
So first let me tell you that here this time result this syntax could be actually different.
Instead of just writing this line of code that makes you comment out of this line of code and here I
can say Time result.
Time is on plus assignment operator.
Actually have one hour I can say one hour right.
This syntax is actually the same as the syntax here.
OK.
You can use either of them.
So let's actually go inside these LCF statement.
And here I can say Time result plus assignment operator.
And here I can just refer to this time left in our word as valuable plus and that I can put two quotes
here and here I can put a space and then I can say hours and then an address space and at the end because
I told you I want to put the minutes after the hour is semicolon right.
So here we are we are going to get the time left in our last year plus the hours and we are going to
assign that value to this time result.
So let me actually also show you the other syntax.
Let me put another let me actually comment out this line of code.
I could have right this line of code as this one I could have said time result.
Assignment operator time result plus time left in hours plus.
And then I put 2 coats hours space semicolon.
That's it right.
This line of code here.
This syntax is exactly the same as this one.
You can actually do the same thing but the syntax is actually different.
So now that we have the hour it is let's get the minutes.
OK.
So let's after the ending curly brace of this statement and before the end in curly brace of the Smurfette
here I am going to get the minutes so that data type of this radio is going to be integer minutes left
right.
Assignment operator.
So first let me actually show you the formula in order to get them in it's actually left right.
So I put a pair of pants this year in order to get the minutes.
We must first actually minus the value of them actually time left variable.
So I can say time left which is a flawed right.
If I actually show you this variable you can see that this value this value the stuff that floats.
And here I can see time left minus.
So we have this time left in our list which is of type integer right.
These two values are actually the same but this one is actually a float value which has a decimal value
also.
But this one this time of ours doesn't have a decimal value.
So the formula is this time left which is the float value minus time left in our list.
OK.
And then here I just need to multiply the result of this operation by 60.
So that actually puts the entire expression in inside the actor to Apprentice's.
So first it's going to execute this operation here inside the apprentice's.
OK.
And that the result of this operation is going to be multiplied by disvalue 6 the semicolon.
This is actually the formula in order to get the minutes that actually is left in order to get to the
location to the destination location.
So here we have an error or the is of type integer.
But the result of this operation is going to be off like floats.
So we must actually cast this value to an integer value.
So here after the assignment operator I just put a set of practices and inside the Prentice's I can
say it.
So it's going to actually cast this value to an integer value and the decimal value is going to be element
eliminated that decimal points the values the number after the decimal point is going to be eliminated.
And the result is going to be assigned to these minutes left minutes left valuable of time integer.
So now that we have two minutes left variable Let's see how we can use it.
So here I can create an if statement if minutes left is equal to one here I can actually open and close
this Satan by using these curly braces so I can get the value the current value of this type result
which currently has the value of the hour right.
Time result.
Assignment operator time result plus two coats.
And here I can actually say one minutes right semi-colon.
So that's why we actually provided spaces here for this hour's string value.
Here is a line number of 76.
You can see that here because I want to actually put the minutes after the hour.
So here we have one minute here so I could have used actually the other syntax.
Let me actually comment out this line of code in order to show you another syntax here.
So I can say Time result plus assignment operator and I can put two quotes here one minute right semicolon.
So let's create an elusive statement for this if statement.
So after the end in curly brace of this statement I can't say.
Else if.
Else.
And inside the parenthesis I can see LCF minutes left is actually greater than 1.
So in that case we are going to say Time result.
Assignment operator time result plus.
So we get the minutes left minutes left on here I can put a plug concatenation operator.
This is the plus OPERATOR Two coats.
I can't say actually I can't put a space here.
I can say minutes semi-colon.
Let me show you the other syntax.
Let me comment on this line of code and here I can say Time result time result plus assignment operator
actually minutes left minutes left plus and two coats I put space here.
And then I can say minutes semi-colon.
So here after the end in curly brace of this LCF statement and before the end in curly brace of this
method here let's actually create an if statement.
The final statement of this method I can't say enough time left in our test is actually less than or
equal to zero and that I put D and the logical operator here and I can't say minutes left is less than
or equal to zero.
So in that case we are going to just say Time result assignment operator and I can't see less than less
than a minute.
Is left to get to the destination location destination location.
Right semicolon.
And finally here if you specify that this McFate must return a value of type string.
So we are going to return the time result.
So return time does not semicolon.
That's it.
This is actually how we implemented our taxi manager class.
Right now it's time to go to the main activity class.
We're going to continue building this application in the next tutorial.
Thank you very much for watching.
And I've seen the next story.