Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed C# Objects!
You have completed C# Objects!
Preview
Let's use what we learned about static methods and the Math class to finish coding up the DistanceTo method.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
The last thing we needed to do to
complete the Cartesian distance formula,
0:00
is to add these two values together and
take the square root.
0:04
We can actually do that
in a single statement.
0:08
We can say Math.Sqrt of
xDiffSquared + yDiffSquared.
0:12
There we go.
0:23
We've coded up the cartesian
distance formula.
0:24
Now we just need to return the result.
0:27
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up