code for assignment 6 for cs758