CSE 264 Homework Assignment 4 – Calculator

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (4 votes)

Objective
To gain a better understanding of HTML DOM programming with JavaScript.
Description
You will create a simple four function calculator in html.
Instructions
1. Create a single html page that implements a simple four function calculator in the style of the old HP calculators.
You perform calculations by entering numbers, pushing them on the stack and then selecting operations (+-*/)
which pop the top 2 operands off the stack, perform the operation, display the result and push it on the stack.
(a) Create a new HTML5 NetBeans project.
(b) Display
i. The calculator display should always be right justified.
ii. It should initialize with a 0 in the display.
(c) Keys
i. The numbers on the digit keys, 0-9, should be red; all the others, black.
ii. The Push button should take the current number in the display and push it on the stack.
iii. The four function keys (+ – * /) should perform their normal functions on the top 2 values on the stack and
push the result.
(d) As each digit key is pressed, the digit should be concatenated to the right end of the display. If the result of a
calculation is being show in the display, then the first digit pressed should replace the result with that digit.
(e) The calculator does not need to have any notion of operator precedence.
(f) The +/- key should flip the sign of the number in the display (and internally).
(g) The C key should clear out the calculator, as if it had just been turned on.
(h) The calculator should ignore any attempt to key a 2nd decimal point for the number in the display.
(i) All the keys are used by clicking on them with the mouse.
(j) The display should be read only.
(k) All internal arithmetic should be floating point.
(l) Make sure the calculator works in Chrome and Firefox. Don’t worry about other browsers.
(m) Coding Style
i. Use a linked style sheet for all your styles. There should be no style declarations in your html file.
ii. Use unobtrusive JavaScript (all your JavaScript should be placed in a separate file).
2. Submission
(a) Zip up the project and submit to Coursesite.