# CSC113_Lab9 - King Saud University College of Computer and...

This preview shows pages 1–2. Sign up to view the full content.

College of Computer and Information Systems, Department of Computer Science CSC 113: Java Programming-II, Spring2011, April 30, 2011 Lab #9 : Exception Handling Exercise 1: Arithmetic Exceptions Write a method and then write a main to test it. The method should handle some Exceptions as the following: Start with a loop so that the user is repeatedly asked for the numerator and the denominator. For each set of data, the program prints out the result or an informative error message if there is a problem. (Division by zero or poor input data). The program continue looping, even if there is a Exception. Exit the loop when data entered for the numerator is "e" or "E". Don't print out an error message in this case. Don't ask for the denominator if the user just asked to quit. Here is sample output from one run: Enter the numerator: 12 Enter the denominator: 4 12 / 4 is 3 Enter the numerator: 12 Enter the denominator: 0 You can't divide 12 by 0 Enter the numerator: N You entered bad data. Please try again.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 08/18/2011 for the course COMPUTER S CSC 113 taught by Professor Dr.safwanqasem during the Spring '11 term at King Saud University.

### Page1 / 2

CSC113_Lab9 - King Saud University College of Computer and...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online