wrote most of program 9 for cs758