complete codes for all 3 assigned problems