solutions for program 5