00:01
Good day, ladies and gentlemen.
00:05
So today we're looking at problem number 817, and it's on the point class.
00:17
And to be honest with you, it's a whopper of a question.
00:21
So let's dig right into the solution.
00:27
Okay.
00:27
Okay.
00:30
So for starters, let's describe, there's a number of steps that we have to do on this problem.
00:38
Oops.
00:41
It is not working.
00:43
Come on.
00:44
Okay.
00:47
Okay, that's probably why.
00:48
Okay.
00:51
What is going on here? okay, there we go.
00:57
Okay.
00:58
So first off, we have.
01:02
Have to define a class called point.
01:07
And to this end, so we're going to define a class called point.
01:15
Okay.
01:16
And in this, in this class, we're supposed to give it two private data points, which have the initial values, x equals zero and y equals zero, and their corresponding get methods.
01:33
Okay, so what this means, what this in particular is telling us a couple things.
01:40
First off, we have to define the initializer here, and it is self and x, oops, sorry, x equals to zero.
01:56
Now, this guarantee, this guarantees that the x value starts.
02:04
As the initial value zero, and it's the same thing with y.
02:10
Okay, and now because, oops, i'm sorry, now because they want it to be private, we have to go self -dott equaling to x, and self -dot y equals to y.
02:36
And when we do this, this definition of x and y, this tell this this makes x and y this makes x and y private, okay? and now what we want to do is i'm going to define self whoops, self dot p or self -dust self -p or self -dust.
03:08
Point to equal to and this is going to equal to self dot x and so this is going to equal to self.
03:29
Okay, so this is actually the the point itself.
03:34
Okay.
03:36
And now going on words, okay.
03:40
So now we want to have two the corresponding get methods.
03:49
And what that means is we want to define something, and i'll call them get x cord, oops, cord of self.
04:03
And what it wants is, whoops, i'm sorry, i forgot that.
04:10
It wants us to just return the self.
04:21
So when they're after the get method, what he's after is just printing, he wants us to just return the value, the x coordinate, and of course the y coordinate here.
04:39
So he wants both get my cord.
04:45
It's the same thing here, which he just wants the same thing for the self -doops, self -dot.
04:59
Okay, so that's just returning the coordinates.
05:04
Okay, so now the next one says, oh, that's the constructor, constructs a point.
05:15
So that's really what this is.
05:16
This is the, this is the constructor, constructing the point with the specified coordinates.
05:23
As you'll see that self -dot point has the corresponding coordinates.
05:29
Okay.
05:30
So, okay, so we're down to there.
05:34
And now the next, the next step asked us to construct or calculate the distance between our, our point and another point.
05:50
And so death, we're gonna call this distance and self.
06:00
And let's call it point two, okay? and here we want a distance.
06:14
Oh, right, so we just return the square, root of let's see we want square root of self so this is the x minus point two dot get x cord and that is squared or maybe times i'll just do the same thing again.
07:02
Make it easier, i suppose.
07:05
Control, copy, three.
07:11
And then plus, we basically want to do the same thing again, except we want to replace the x coordinate here by y.
07:24
Point y coordinate.
07:27
So this is the corresponding distance.
07:30
It's basically x1 minus x2 squared plus x or y1 minus y2 squared and then taking the whole square root of that.
07:48
So we're just, and again we're using the get y coordinate for point number two.
07:58
So it's self.
08:01
Yeah, self dot y.
08:03
So self .y corresponds to the y coordinate of our given point, and then point two is the point we're taking, and that's we're using the get y coordinate to get the y coordinate of the other point.
08:21
And i wanted to point out that this right here, this get y chord is why you actually create these get these get coordinate values here, these get methods.
08:38
I was kind of wondering why we did that, but it turns out that that's one of the, i think that's one of the reasons we knew that, is because when you're working with the second point, you can't just use the self .x or whatever.
08:58
You have to actually get those values.
09:00
Anyhow, so it is something i learned.
09:03
One of the things i learned while doing this problem, why we use the get, why we have these get modules or what will.
09:17
Okay.
09:18
And the next one we're supposed to have is we're supposed to have this nearby function.
09:27
Nearby, of course, itself and point two.
09:37
And this guy, we have to check if, if, sorry, self.
09:52
Distance.
09:55
Point two is less than five.
10:02
Then we just return true and else we return false.
10:13
Else we just return false.
10:23
And this one, we're just calling the distance module and we're checking the value, and it's a value between the self and point two is less than five.
10:37
We're good, otherwise it's false.
10:40
Otherwise, it's going to be full.
10:43
And the final one we have to do is a string module, which now this one, in particular, this is a case of what they call the operator overloading...