solved the programming example from OOP6 selfstudy