I am trying to write a Java application to simulate a simple
calculator. The user interface for this application has two parts. At
the top is a one-line text box. The bottom consists of a bank of 15
buttons, formed as a 5 by 3 grid. The fifteen buttons includes the
digits 0-9, and four operations addition, subtraction, multiplication
and division, and an "enter" button.
The user enters numbers using the numeric buttons. Numbers are
terminated by either hitting enter, or hitting an operation button. An
operation is saved until the following number is entered, when the
result is calculated. For example, if the user enters
1 2 3 + 4 5 (enter)
The result 168 should be displayed in the text box. The text box
should display the current number as it is entered, and the most
recent result when an operation is entered. |
Request for Question Clarification by
maniac-ga
on
06 Mar 2004 18:50 PST
Hello Math01,
Are you looking for java source code to adapt to this problem or must
the code fully meet your needs? For example, I found a simple
application using JDK 1.2 and Swing to produce a calculator but the
number buttons are in a 3x4 grid (plus period and equals), has the
four functions (and clear) on the right, and exit, help and about on
the bottom. It does slightly more than you ask plus it needs to be
modified to match the layout you specified.
Also, it may be necessary to indicate what JDK (and optionally IDE)
you are using to make sure you get the code you need to build this
calculator. Please indicate that in your clarification.
--Maniac
|