edited codes

programming assignment 2 finished.