Code for assn6 of cs3250