Assignment 4 – Number Systems

Maximum Points = 50

The purpose of this lab is to focus on the study of classes, objects, GUI, and error checking through exception handling. This is also an opportunity for the students to participate in a pair-programming experience.

 

Your program will allow a user to enter a number (in binary, decimal, or hexadecimal) and then convert the number to a user-selected number system (binary, decimal, or hexadecimal).

 

Your program should use a GUI with a title and a graphic. The GUI should

v  provide a text field for the user to enter the number before conversion,

v  provide two combo boxes for the user to select the number system of the number to be converted and the number system of the result,

v  display both the number before and after conversion.

 

For example, if the user enters A5 as a hexadecimal number and selects decimal for the result, your program would display 165 (10x16+5=165).

 

If the user enters 17 as a decimal number and selects binary for the result, your program would display 10001 (1 x 24 + 0x23 + 0 x 22 + 0 x 21 + 1 x 20=17).

 

[http://csc.ColumbusState.edu/woolbright/CONV.HTM provides examples and instructions for the conversions]

 

Create exception classes that catch and handle the exception thrown when the user selects a format and then enters a number that is not of that type (e.g. selects binary with a number 123). Handle the exception by displaying an appropriate message and then continue processing.

 

Due before class on Wednesday, October 27, 2010) Submit a .doc file containing the UML class diagram showing inheritance for all the classes used in your program and your timesheet documenting your time. [10 pts]

(Due before class on Wednesday, November 3, 2010) Submit your .java files containing your program, a Word document describing your program and your timesheet documenting your time to the dropbox in WebCT. [50 pts]

 Grades are determined using the following scale:

Grading Rubric  (Word document)