A stripped down version of my program is in the 2 files copied below. It is a simple calculator like in Windows accessories. The example below only does addition and subtraction however it doesn't work. Here's how it is supposed to work. A number is sent to the textbox using button clicks and when '+' button is clicked the displayed string is converted to double. The displayed string remains displayed until the first digit of the next number is entered then the first number is cleared and the second number begins in the display. When '=' is clicked the second displayed number (actually a string) is converted to double and added to the first double number. The operation should be controlled by the 'opFlag' and 'addFlag' settings. The problem apparently is that the 'if' statements that set the flags are not being executed. I tried NetBeans debugger to watch the values but I don't know how to use the debugger well enough. I'm hoping someone here can tell me what I'm doing wrong so I can move on. Your comments will be appreciated. TIA Bill S.
I copied part of your code, and re-posted it here using "code tags". as you can see, it is formatted much better, is context-highlighted, and is much more readable. Please start using these in the future. You can simply highlight your source and click the button labeled "code" above where you enter your text.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: May 09, 2012
this is a test. Your method removed indentation and removed context highlighting. Your method does the opposite of what you say.