I am creating a desktop application that will also include a calculator, similar in function to the calculator of the Microsoft Windows OS.

I require some assistance in implementing the memory capability such that the user can store a number, recall the number to be used in a calculation or delete number from memory.

I was thinking that an array could be used where the user would temporialy store a number in memeory, but I am not so sure about the overall structure to implementing such a feature.

Would really appreciate it for some ideas and tips.

Regards,


Sam

Recommended Answers

All 3 Replies

What's wrong with just using

double memory;

All you have to do is store a number and that's all a variable does.

I thought with an array to use the following method to "clear" memory:

Arrays.fill(memory,0);

memory of being declared of type array

You only need an array if you are wanting to store more than one value. If you just want a single value for "memory" then all you need is a variable and just set memory=0 to "clear" it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.