CS 1401 Introduction to Computer Science
Fall 2013, Lab 12

Objective. The purpose of this lab is to practice exceptions.

Background. In your Labs 9-11, you designed methods to deal with fractions. In these labs, we did not require you to take into account:

Assignment. Modify your Lab 10 so that when in both 0 cases, a proper exception is raised, and a proper action is performed. Specifically:

In the main method: Catch the exceptions thrown by the Fraction methods and print appropriate error messages.

In addition, if the user provides invalid values for a numerator and/or a denominator, catch the exception and print an appropriate error message.

For extra credit. Make a similar modification of Lab 11. Do the same thing as in modification of Lab 10, except that:

Write the error message either in a text field, or in a dialog box (using JOptionPane, as in Section 1.9).

When it is due. Lab 12 is due at the beginning of the first lab section on the week of November 25, i.e.: