Store numbers in mvc Calculator java

Hi there,

I'm just making a mvc java calculator in java. At the moment i can't store numbers then do the calculations.

I have only done double text field calculators not single.

What has to happen is type a number into the display field, then by clicking + or - key the number stores the number so the second can be entered and then perform the calculation etc.

Any links would be awesome , thanks. I've searched around but can't find it yet.

Re: Store numbers in mvc Calculator java

Quote:

i can't store numbers then do the calculations.

What is the problem storing the numbers?

Most operators take two operands.

When are the operations done?

After the operand following the operator is entered?

Re: Store numbers in mvc Calculator java

Thanks Norm, Basically its a typical calculator set up with one input screen/textfield.

I need the calculator to read the number, ie. the user inputs 123, then when they push + _ * etc. it clears the screen stores the number then reads the next number the user inputs, then stores that number.

Then, when pushing equals, it will perform the calculation, i was gonna do a switch statement for the operands but i need to read the numbers properly first, i have read numerous articles and source code but this is a specific scientific calculator written in java mvc. I have yet to come across a good example of mvc calc written in java.