first crack at pseudocode to code
completed 3.4