Finished Homework 3 d)

have fun testing it a little bit please read through the comments to
understand how its done!