ScratchData LogoScratchData
Back to gtoal's profile

calc

GTgtoal•Created September 11, 2010
calc
15
16
1420 views
View on Scratch

Description

This is a template for anyone to design and build their own calculator. It is very modular and all the code except the number printing is trivial. Draw your own skin in any tool, then link the buttons to the code by simply drawing a black rectangle over each button as the skin for that button. Start by dragging the existing buttons into place as a rough guide. This is a reverse polish calculator with a explicit push-down stack. The stack is visible in this demo although you may remove it if you need space for more buttons. To create a new function, duplicate an appropriately similar one (eg '-' for a binary operator, or 'int' for a unary operator) and modify the logic accordingly. You can build a very powerful custom calculator, quickly, with this framework. Currently I am still developing the code and there are two known bugs in the tricky area of number display: negative numbers and decimal parts are broken, and display of large numbers > 10^9 are not implemented. Otherwise the code that is finished is extremely robust. (There's also one 'To Do' - parameterise the size and position of the numeric display. It currently is positioned for a previous skin I was using.)

Project Details

Project ID1292083
CreatedSeptember 11, 2010
Last ModifiedOctober 15, 2014
SharedSeptember 11, 2010
Visibilityvisible
CommentsAllowed