finished ch7 programming challenge 6...meant to do this way earlier.