CS
205 - Programming for the Sciences
Spring 2008 - In-class
Exercise for 01/17/08
Today's exercise is to finish the very simple (and stupid) RPN calculator by adding various types of error checking and a form of keyboard entry. We will look at if-statements in more detail, use a switch statement, and start looking at methods.
Assignment
(10 points) Working in pairs, add the following features to the calculator
The initial value displayed should be 0.
The backspace button should reset the display to 0 when the last digit is erased.
When the input is 0, clicking the 0 button should have no effect.
When the input is 0, clicking on any other digit should remove the 0. I.e., no leading 0.
When new input is to be started and the first button clicked is dot, the display should read "0."
When the current input contains a dot, clicking the dot button should have no effect.
Add keyboard entry for digits, dot, Enter, and backspace.
We will work through the implementations of these features during class. When you are finished, demonstrate your program to an instructor.
01/16/08