The Source for Java Technology Collaboration

Home » java.net Forums » The Big Question » The Big Answer

Thread: Java Calculator (Basic)

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 7 - Last Post: Apr 5, 2009 10:48 AM by: mukesh11 Threads: [ Previous | Next ]
shanezz

Posts: 1
Java Calculator (Basic)
Posted: Apr 29, 2007 10:11 AM
  Click to reply to this thread Reply

Hi can anyone help me on this i have to do a basic calculator with Java that contain two integer fields and an array,results. It should be capable of adding 2 numbers, subtracting 2 numbers, dividing 2 numbers, and multiplying 2 numbers, and giving the remainder after division of the two integer numbers, any help would be greatly appreciated, thank you.

mwithake

Posts: 2
Re: Java Calculator (Basic)
Posted: Apr 30, 2007 5:54 AM   in response to: shanezz
  Click to reply to this thread Reply

homework?

jmguillemette

Posts: 7
Re: Java Calculator (Basic)
Posted: Apr 30, 2007 7:16 AM   in response to: shanezz
  Click to reply to this thread Reply

ill help you .. but i would need you to post up what you have written so far.. and a description of the problem your running into :)

coxcu

Posts: 184
Re: Java Calculator (Basic)
Posted: Apr 30, 2007 8:08 AM   in response to: shanezz
  Click to reply to this thread Reply

Here's an interesting, if dated, article that uses development of a calculator as an example.

"XP Testing a GUI with FIT, Fitnesse, and Abbot"
http://www.csis.pace.edu/~bergin/xp/guitesting.html

ewin

Posts: 39
Re: Java Calculator (Basic)
Posted: Apr 30, 2007 9:55 AM   in response to: shanezz
  Click to reply to this thread Reply

A fundamental idea of homework is that one does his own. That is, you, not we, do your homework.

And to all the ones who want to be helpful, consider this. Imagine you become a professional developer. Do you want to work with colleagues who got their programming credentials by letting others do their homework? Do you want to have to do their work in addition to your own, because they are used to others doing their work and can't deliver?

jmguillemette

Posts: 7
Re: Java Calculator (Basic)
Posted: Apr 30, 2007 10:03 AM   in response to: ewin
  Click to reply to this thread Reply

Most developers get annoyed by people asking for help.. we are very much in a solve it your self mentality.

i however will gladly help a person.. assuming they in turn do the work.. i can guide and teach.. NOT do.

For exactly the reason mentioned above

rickcarson

Posts: 85
Re: Java Calculator (Basic)
Posted: Apr 30, 2007 4:24 PM   in response to: shanezz
  Click to reply to this thread Reply

Apple's section for developers has half a dozen different currency converter examples, which is similar to the calculator you describe. I think one of the Objective-C books has a calculator that it builds up as an example as well.

The 'trick' with a calculator is to keep some kind of rolling total.

mukesh11

Posts: 1
Re: Java Calculator (Basic)
Posted: Apr 5, 2009 10:48 AM   in response to: shanezz
  Click to reply to this thread Reply

This applet accomplishes a couple of different things: obviously, it is an example of a calculator, but also displays an example of how to multithread an applet. The Time Used display on the left-hand side near the bottom is a thread ran from within the applet itself.

The Current Time display on the right-hand side near the bottom is a thread that was declared in class called "Clock" which extended Thread. It is instantiated within the applet and the overridden run method inside of the Clock class obtains the current time for display.

The calculator itself has been set up to handle keyboard events, but as far as the program is concerned the focus must be on the applet in general -- the keystrokes won't work otherwise. To do this, click on any empty area of the applet.
------------
mukesh11
Currency Converter - Currency Converter




 XML java.net RSS