How do you make a Calculator

edited November 2016 in How To...

I am trying to create a replica of the windows 7 calculator, but don't know how to do so without using 100,000 + if statements.

NOTE* I am slightly know to the whole programing thang, but at the end of this project I would like to create a working replica of the windows seven main screen. Start button, working tabs, etc. Thanks for your help if I receive any. ;)


  • Calculator ^^^That is my model for the calculator...

  • How would you do it using 1000000+ if statements?

    Do you know how to use classes? Draw rectangles? Numbers?

    Do you understand how to use variables and do math operations on them?

    Without seeing any sample code, we have no idea where to even start helping you.

    That said, if I were doing it, I'd start with a Button class that can be clicked on.

  • I might also suggest as an alternative approach: instead of starting with mouse clicks and a button class, begin with keyboard input and printing answers using println(). Once you have the basics of an infix calculator working, add graphical buttons and a display on top.

Sign In or Register to comment.