Program 6 for CS201