finished script for problem 2. Still need to check calculations.