my solution to programming asignment2