Please use code-tags and if you have a problem then say what the problem actually is rather than simply dumping code. Also, use the title to provide a quick problem summary.
Also, if this relates to a specific problem (such as Physics) then please post in the appropriate forum.
Thanks.