coding solutions for last assignment