finished off the programs for chapter 4