Completed code of ProgAssig2