Week 13
Error handling. File input/output. Project review.
Reading
Java for Everyone, chapter 8.
Homework
All numbered problems are from Java for Everyone. Due Wednesday, April 20.
- Chapter 8, P8.2
- Write a program that reads this file and prints the year when the average measured CO2 increased the most.
See here for more information.
Hints: write a method that will read the file, ignoring lines that begin with “#”; Save each column in a separateArrayList
; write a method that takes an ArrayList as input and returns the difference between each pair of consecutive elements; write a method that takes an ArrayList as input and returns the index of the maximum element. Alternately, a more efficient way would be to compute the differences as you go along, and save only the current maximum.