CS 1401, Quiz 13

Date: Tuesday, April 22, 2008
Name (please type legibly, ideally in block letters): ______________________________________________________________________

Write a piece of code that, given a file data containing one real number per line, computes the sum of all the numbers from this file. These numbers should be positive. Make sure that an appropriate exception is raised if one of the values is not positive and that the corresponding error message is printed.

For extra credit: generate an additional exception (and the corresponding error message) in the situation when the file data is empty. Warning: extra credit will be only given if the main assignment works correctly.