CS 112 Project 2
Calculator
Due Friday, Feb. 15th 2008

For your second project, you will create a simple calculator.  Your final project should look like:

Calculator Screenshot


The calculator should function as a normal calculator.  The output display can be either centered (as above, which is the easiest thing to do), or right-justified (as in a standard calcualtor display)

Grading

You will be graded on several criteria:

Program decomposition:  10

Each method should do only one thing: you should have private/protected helper methods so that no one method is too long, or tries to do too many things.  You should only need to write two different button handlers (that is, classes that implement ActionListener) --  one for numbers, and one for operators.  You will of course need a total 16 different instances of these button handlers, one for each button.  Remember that you can pass parameters to the constructor of the button handler. 
Also, the constructor for your main calculator panel needs to do a whole lot of work (set up subpanels, buttons, etc) -- you should probably have helper methods instead of one larger constructor that

Coding standards 10

Be sure to do proper indentation & commenting

See the Coding Standards for more information

Working

Window with output display and buttons in the correct locations 20
Can enter numbers 10
Can enter multiple-digit numbers 20
Can calculate a simple expression with two operands and an equals (20 + 15 = would display 35, for instance)  20
All operators and C (clear) work correctly 5
Can chain together operatons (10 + 15 + 20 + 30 = would display 75, for instace) 5

Submission

All file(s) required for your project should be in the folder https://www.cs.usfca.edu/svn/<username>/cs112/Project2/

Hints

There is no one right way to do this assignment.  Here are some hints to get you started (you do not need to follow these hints)

Extra Credit


If you want a greater challange, you can get up to 20 points of extra credit by creating a calculator that can handle floating point numbers and unary (that is, takes a single argument) operators.   An extra-credit solution would look something like:


Extra Credit Screenshot

You have some lattitude as to what extra buttons you can add for the extra credit.  See me for more information.