CS 1401 Assignment #10

Date Assigned: Monday, April 10, 2006 or Tuesday, April 11, 2006.

Due Date: correspondingly, Monday, April 17, 2006, or Tuesday, April 18, 2006, before the beginning of your lab section.

Goals: to learn how to include error-handling mechanisms in an application.

Points: This assignment is worth a total of 20 points. No late assignments will be accepted, but credit will be given for partially completed assignments turned in on time.

Assignment: please do Programming Assignment 4 on pp. 475-476 of the textbook. The objective of this assignment is to write a Java application that converts letters of the alphabet into their corresponding digits on the phone; see the textbook for details. Your application should raise an exception if a non-alphabetic character is entered, and, based on this exception, provide the user with a corresponding error message.

Suggestions: it is OK to use if-then statements and a while loop; it is also OK to use switch statements and other additional control statements from Chapter 9.

For extra credit: make a GUI that enables the user to read a letter and convert it to the corresponding digit. Caution: extra credit for the GUI part will only be given if the program works correctly. So, if your program does not yet work correctly, first make it work and only then - if you have time - start working on your GUI.

Deliverables: as announced in the labs.

Homework part. On a separate sheet of paper, please do Exercise 5 (p. 470) and Exercise 2 (p. 472). Explain your answers. Return the sheet with your answers to your TA by, correspondingly, Wednesday April 12 or Thursday April 13 before the beginning of your lab session.