code realize for  the book "Beauty of Programming"