Help with some finishing touches on my calculator project

Help with some finishing touches on my calculator project
0

#1

I’m putting some finishing touches on my calculator project. Overall I’m quite happy with it, but there are a couple things I was having trouble with/ wanted to ask about.

http://calc.ddryburugh.com/

  1. I enclosed my calculator in it’s on container div. At some point, (can’t remember when exactly) it disappeared. I’m trying to add a drop shadow to this to make it pop a bit from the page, however my css for this isn’t appearing.

  2. I want to make sure I understood the user story correct for chaining operations. Lets say you wanted to calculate 2+42. With my calc you would enter the 2+4 and when you pressed * it would sum, then allow you to multiply this by 2; for an answer of 12. Is this ok, or are you supposed to be able to enter the entire operation 2+42, and it would then deal with proper order of operations and give an answer of 10?

  3. I’m having some trouble with large digits staying on screen. I’ve coded things so that a user cannot enter a number larger than 9 digits to help combat this. However if you were to continue multiplying a number up eventually the equation and answer start to run outside of the div. How could I prevent this?


#2

Anyone able to assist here?


#3

This would be much easier to diagnose if you could provide your code in CodePen, or at least link to your code in a repo.

This sort of implementation detail is entirely up to you. See this post:

Note On Calculator Logic: It should be noted that there are two main schools of thought on calculator input logic: immediate execution and formula logic (our example utilizes formula logic and observes order of operation precedence, immediate execution does not). Either is acceptable, but please note that depending on which you choose, your calculator may yield different results than ours for certain equations (see below example). As long as your math can be verified by another production calculator, please do not consider this a bug.

Scientific notation comes to mind. Smaller font size is possible. You could also keep in mind the maximum size of numbers in JavaScript and leave room for up to 16 digits. First option is coolest, IMO, but the second is easiest.


#4

Thank you for your answers. Glad to hear the way I programmed the logic is acceptable. I had trouble putting my code into codepen, for some reason it just didn’t translate properly. I’ll have another attempt at it though.