In this lab you will build a simple calculator as a swing application.
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 use inheritance.
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 only when you press one of the number buttons with the mouse (that is you must prohibit the user from typing directly into any JTextField that you have. (use setEnabled(false) on the field.). 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 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:
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. (example: how will you query user input for the type of game and the number of bets?)
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.
When your readme and your code is ready, zip up your files and email them to me as you did in the last lab.