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
Static fields, like static methods, are called directly on the class name - unless you're already in the class.
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
Let's start by deciding how accurate
we want our towers to be and
0:00
then make that a constant.
0:02
We'll set the accuracy to .75.
0:04
Meaning on average 75% of the time
the tower will hit its target.
0:08
No let's create a method
that when called returns
0:14
true when the tower
successfully hits the target.
0:17
We'll call it IsSuccessfulShot.
0:20
Now here's where we can use
our random number generator.
0:23
We can ask for a number between zero and
one by calling NextDouble, and
0:26
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