Homework 3 Extra Credit Completed

Reviewed Ahsan's code and managed to fix mine (thanks Ahsan for the tip
on type cast). Still need some clarification on why my version didn't
work.