code for example 3.5