Program written for class assignment