Fourth exercise for Stanford CS193P online Objective C course