my version of Programming Assignment2