Program 3 for CS240