This is the solution from the Engineering Department Please study it carefully and compare with your own program
BTHS Engineering