Last Updated on February 12, 2024

Calculator Project

Project Goals

The goal of this project was to create a calculator that could perform basic operations with only two operands at a time. This meant that even if a user was doing a long chain of operations, say \(7+2-6/7\), the sequence would be calculated in the order it was created (as opposed to following the order of operations). Additionally, I needed to have functionality to allow the user to clear the display when desired.

Extras

For extra credit, we were tasked with adding a backspace button, floating point numbers, a nice looking UI, and keyboard support. If you’ve looked at any of my other projects, you already know I felt compelled to complete the extra credit lol. In addition to that, I took inspiration from other students and added a way to oscillate the sign of the number from positive and negative. I also created a dual display that would show the current and past (completed) inputs. Then, I spent some time finding nice fonts for the project. That was fun!

Oh and the floating point thing? We were supposed only allow for a single decimal point for input. Of course I went beyond that and made it so that the user could input as many as would fit into the display. I quickly learned why that rule was in place, though. It was a pain in the ass to get near accurate numbers, but I’m a stubborn girlie so.. I figured it out lol. The results are accurate enough for what it is.

Completion

Overall, this project ended up being a lot simpler than I expected. I started the project in late December and finished most of it by the new year. Part of the reason this project was easier to complete was because I had calculator related assignments in both JavaScript.info and the Odin Project JavaScript exercise set. Both were JavaScript only (so no UI) and the solutions did not carry over completely. However, both assignments gave me enough of a foundation to complete this project with relative ease.

There was one snag, however. A CSS issue on iOS devices put me on a whole side quest that I will discuss in a separate post. And that one little thing made it so that the project wasn’t fully finished (in my eyes at least) until January. It got done, though, and now, I’m happy to say that this was the last project of the Foundations section of the Odin Project! I’m looking forward to what comes next.

You can play with the calculator here and take a look at the code here. Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *

four × 3 =

Table of Contents

Expand ToC