calculator example from chapter 6 of bjarne