Do this code was given by your teacher's if yes what is the due date.
I recommended you to first identify that which sensor is being used here and see the very basic programming of it after that you will slowly join all the things and able to understand
Thanks
Krishna