|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (8 bit)
Join Date: Nov 2001
Location: Philly
Posts: 189
|
Help me with JAVA
Hi, I have a java program I have to write for school. I am having some problems. I have to create a calculator (like the windows one) with the add, subtract, mult, and divide functions.
Here is the wording: Minimum requirement: addition, subtraction, and multiplication of two single digit numbers should be implemented. Usage: first, use mouse to select the first number; secondly, select an operator, then select the second number (in order, rather than pre-order, nor post-order). Press the “=“ button and display the result in a JTextField. Here's what I have so far but it is not working (im doing it in JBuilder but this file is text so all can view). ANY ANY ANY help would be appreciated. Im just going for functionality now, I'll try to make it look "pretty" later. FILE: CLICK Thanks! |
|
|
|
|
|
#2 |
|
Member (7 bit)
Join Date: Nov 2001
Location: Rochester, NY
Posts: 87
|
I've just looked at it briefly, but I think you may want to look at the following:
I see that you have a class "Operations" to handle the actual calculations, but I don't see where you actually call it. It appears that the code just continually adds chars to the text display. If this is correct, you may want to try something like this: You would also need to put code in the Operations constructor to retrieve the 2 values and the operation sign from the main text display. I haven't actually compiled or run this, so it is only a visual inspection. Sorry if I'm too far off base. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|