add my sample code from chapter1 to chapter4