first half of cs1400 code, written in Visual Studio