Project 2: Calculator
Write a web application that implements
a four function calculator.
Let the display be capable of showing a
maximum of 16 digits
including decimal point if required.
Use Decimal type for all calculations.
Round results of operations to 16 digits.
Results with more than 16 integer digits are
When entering a number, disable input
after 16 digits are entered.
Each operation (+, -, *, / ) is of the form
Display = Acc Op Display
Display is the contents of the Display
Acc (“accumulator”) is the contents of
the Display when the Operation button
Prior to entering the second operand
Op is the operation (+, -, *, or / )
Pressing any Op key (+, -, *, /)
Performs the currently pending operation
putting the result into the display.
Copies the new display contents into the
Sets the specified operation as the new
Sets the state such that if a digit key or dot
key is pressed, a new number is started in
Pressing the = key has the same effects as the
Operation keys, except it sets the pending
operation to No Op.
Clear sets both the display and the
accumulator to 0.0 and sets the pending
operation to No Op.
Clear Entry just sets the display to 0.0
Toggle sign reverses the sign of the display (if
the value is nonzero.)
If there is a decimal point in the display
do not accept another decimal point.
Disable “Dot” key once a decimal point has
Display "ERROR" on error conditions
Divide by Zero
results > 16 integer digits
All buttons become disabled except
The calculator requires state information.
Use hidden fields to store state
information with the page and restore on
Deploy your application to your directory
on the cis4930 web site.
Zip your project folder and submit the
zipped file using Blackboard Assignments.
Put the URL for your page into the
Blackboard submission comments box.
Grader should be able to view your page by copying and pasting the link.
You may work with one other person.
OK to work alone if you prefer.
If you do work as a pair
Both members are expected to contribute.
Both members deploy the project to their class
Submit only one zipped project folder.
Enter both names in Assignment Comments
Enter submitter’s URL in Assignment Comments
Other partner submits just a comment including
both names and own URL.
Do not share your work with other students.
Before or after submitting the project.
OK to discuss the project.
OK to look at others’ web sites with a browser.
Do not copy any other student’s code.
Or even look at it.
Do not let anyone copy or examine your code.
Project is due by midnight, Wed night, Jan. 26
No late submissions will be accepted.
End of Presentation 15