CS2136: Paradigms of Computation

D-Term 2004

Assignment 4

Due: Friday, April 30 at 8:50 AM.  Late assignments will not be accepted

 

This assignment gives you experience creating a Java program with a graphical user interface. It builds upon the classes and methods you created for Assignment 3.  If you do not have a working version of Assignment 3, contact the TAs immediately to get a copy of Assignment 3 you can use for this assignment.

 

Create a Java program for doing conversions between numbers represented in various ways. It should have the following features:

 

1)      Implement the program so it runs as a Java applet. You can either provide an HTML file to launch your applet or place the applet tag in a Java comment so you can run the Java file in the applet viewer.  This is your choice, but your “readme.txt” file must make it clear which choice you made.

2)      The program must have a GUI built with Swing components. It does not take any input from the console, and it does not send any output to the console.

3)      There must be a series of buttons that the user can use to type in a FlexNumber. These would include digits, left and right brackets, and plus and minus signs.

4)      There must be a text field that shows the number as the user types it.

5)      There must be a Clear button that clears the text field.

6)      There must be a Backspace button that deletes what the user typed, one character at a time, starting with the last character typed.

7)      There must be buttons to convert the number currently in the text field into the various number representations. That is, a button to convert to FlexDouble, a button to convert to FlexComplex, and a button to convert to FlexLong.

8)      The previous requirement implies that you will need to write a method which can take a String and produce a FlexNumber with the right type and value.

9)      If the number being converted is not correctly formatted (e.g. has two decimal points), an error message should appear in the text field.

 

Remember the following:

·        Put each class in a separate source file.

·        Be sure to use correct and complete Javadoc.

 

In addition to the source files, turn in a text file readme.txt.