Sunday, August 2, 2009

Is there an easy way to make a calculator using visual basic 2008?

It just needs the following operations : Addition, subtracton,dividing,multiplying,decimals and negatives.

Is there an easy way to make a calculator using visual basic 2008?
For a seasoned programmer, I'm sure recreating the wheel (ie writing yet another calculator program) would be easy enough.





You just have to understand each operation, what you want each button to do, and what exactly you want to display.





The idea here is to break everything down to it's simplest components.





In VB.NET, everything is an object with properties, procedures, etc. What exactly should happen when you hit the button with the image of the "+" sign (or any other sign, such as the "-" sign)? What exactly should happen when you hit the button that represents the "Enter" key? How do you plan to deal with division by zero so the program doesn't crash? What will you do if there is an overflow in the math? Remember to include a "Clear" button. Perhaps the "Esc" key can double as a "Clear" button. Will you allow parenthesis for more complex calculations? How about a "Mem" button to save the display in a single-memory storage?





There's a lot to think about, and you must take it one little step at a time.





Don't try to program the entire calculator all at once.





First start with the visual image and layout of the calculator, with all the necessary buttons, then concern yourself with only one button at a time.





Good luck :-)


No comments:

Post a Comment