I have to build a Java calculator, I'm not looking for answers, just tips on how I can put the best foot forward.
I am Sam, Sam I am<br />I do love some Java and a good sandwich.
Patel Chintan
Ranch Hand
Joined: Mar 01, 2007
Posts: 80
posted
0
Originally posted by Samuel Muentes: I have to build a Java calculator, I'm not looking for answers, just tips on how I can put the best foot forward.
Hi sam, You can start with J2SE application for making calculator. For GUI part you can use either AWT/Swing component. Or you can also go with applet. For you logic part you can simply use 'switch' for different operations.
Hi Sam, Welcome to the Ranch. We are happy to have you here
By calculator, I presume you have something graphical, which the user can interact with. You can choose from applications, applets or even some html stuff. You also can make it more interesting (from the development point of view) by making it a distributed system (the actual computations will happen on the server side). In such a kind of scenario you can go in for web-services or RMI or something similar for client-server communication.
If you can share more details of what you have in mind, or what the requirement is, people can pool in more efficiently with suggestions and tips. Until then, we will be just shooting in the dark.
PS. We have different forums for different java technologies. If you can let us know what technology you prefer, one of the administrators can move this thread to a more appropriate forum, as you will stand a better chance of getting solutions and tips.
Thanks for all the great feedback. I'm sure if I had been more specific it would have been more help. I am in a Java class, so this is an assignment, that's why I don't want any help with the code. It will be an applet as well. With that I ask for any tips you may have for me to get started.
While the first 3 would be instantiated only once, the latter two would have multiple instances.
Does this help?
And Listeners for the Buttons. Probably two classes, a NumberListener and an OperatorListener.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35221
7
posted
0
And Listeners for the Buttons. Probably two classes, a NumberListener and an OperatorListener.
Generally I'd agree, but in this case the Button classes do so little that I'd be inclined to have them implement the listener interface directly. That's a minor detail, though.