Isn't the turnAroundTime the sum of all of the burst times, the IO times and the wait times? Here it looks like you're getting all of the IO times, adding that with all of the wait times, but then only adding it with the time of the last CPU burst (as opposed to the total burst time).