Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For your third JavaScript assignment, I would like you to implement this calculator. However, in implementing this calculator, I am going to ask you to

For your third JavaScript assignment, I would like you to implement this calculator. However, in implementing this calculator, I am going to ask you to only have ONE event listener. This means you will need to have a good understanding of the Propagation slide in the Handling Events PowerPoint.
There are just a couple more rules you need to follow for full credit:
You may NOT use the JavaScript eval() function or other similar functions
The eval function is a String to JavaScript function that will evaluate strings like they were code
You may not modify the included HTML code. The only modification you can make is within the script tags
Please note, this should be a basic calculator. I do not expect you to obey the order of operations. For example, if the users enter 7+1*9, an answer of 72 is perfectly acceptable even though the answer should be 16 if we follow the order of operations. You are also not expected to correct JavaScript behavior. That is,0.1*0.1 can result in 0.010...02. You may wait for the user to hit = to perform any calculations or just keep a running total but the calculations should be correct other than what was noted.
These are the operations of the calculator:
c means clear everything from the answerWindow
* means multiplication
/ means division
- means subtraction
+ means addition
. means to put a decimal point in your number
= means perform the calculation placing the result in the answerWindow
number 0-9 represent themselves.
After each item is clicked, it should be placed in the answerWindow or affect the answerWindow in some way or the user (me) will get confused (I am easily confused).
For one final helpful hint, I am going to tell you that the split method we talked about when we were talking about string functions will also take a regular expression as a parameter (not just a substring).
This assignment will be worth 30 points
20 points for a correctly functioning calculator that follows all the above rules
5 points for good comments
5 points for good programming style\table[[Calculator,,],[],[,,c,**,,,],[7,8,9,??,,,],[4,5,6,-,,,],[1,2,3,+,,,],[,0,.,=,,,]]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

80 HR ethics and professional standards.

Answered: 1 week ago