Solution for Exercise 10.1

This is a solution for Exercise 10.1. See the source code for this file, and check the output in the console.