code and graphic for assignment 4