Need help with my first project

So All I have to do is add the code you provided? Where should I add that in the sketch?