The high level objectives of this lab are:
To use event driven programming.
To use swing to build a program with a graphical interface.
To practice inheritance again.
To implement an interface.
You must build a graphical calculator that will allow you to do
simple arithmetic. Your calculator needs to allow a user to input
multi digit numbers. (For the sake of easier programming, you may
assume that the user will never type in more than an 8 digit number,
though you need not enforce this.) Your calculator should accept
numeric input when you press one of the number buttons with the
mouse. You should allow the user to type into the text field as well. (This means that you may get non-numeric input and you have to catch that exception and handle it properly.) When an arithmetic operation is selected, keep track
of the current number in your display, zero out the display, and keep
track of the current operation. When the equals button is pressed,
take the current number in the display, the stored number and the
stored operation, and apply the operation to the two numbers, then
display the result in the display field. A sample user interface for
this program is shown below.
You may use any other user interface that you find easy to make
and functions well as a calculator.
You should handle addition, subtraction, multiplication, division and Square Root operations. Square root will work differently than the rest since it is a unary operation of course.
You must satisfy the following constraints on your program
Your program should be well commented
No one method may be longer than 25 lines long (white space and lines with only braces on them don't count)
One of your classes must extend the JFrame class
When your program is ready, you need to write a readme.txt file that provides me the following information:
Your name
The name of your java files (and the names of any extra non-public classes that are contained in the file.
The implementation decisions that you made. Why did you solve the problem the way that you did?
Directions on running and using
your program. Especially anything that might not be the same for all
students.
And any problems or bugs left in your program. If your program doesn't quite work in some situations, tell me about it. If your program doesn't run or compile, I want to know that before I try.