finished problem6