Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

Damian Adams
Damian Adams
21,351 Points

[Community Code Challenge] Build your own calculator app with the Java skills you've learned!

Hey, so for everyone that just finished up the "Learn Java Track" like me and is looking to work on something to consolidate all of their new-found Java knowledge and prove their coding skills, a basic calculator app built with JavaFX is a great way to do it.

Folks, let me introduce you to OpCalc!

alt text

An "overpowered", simple calculator that only allows you to perform basic operations with your numbers, but provides ridiculous accuracy and range, as well as showing you the order of operations in which the expression you enter is evaluated, with a careless attitude towards overflowing your screen with decimal units.

alt text

For this project, I went ahead and tried to implement a calculator that uses an infix-to-postfix algorithm to evaluate basic arithmetic expressions. The idea in my head was to have the user enter an expression that includes addition, subtraction, multiplication, and division, along with parentheses if the user wishes to use them.

alt text

There are other ways to do this, of course, and I'm interested to see them if you guys are up for it! I promise you, you'll have to use pretty much everything we've learned in this track up until now.

The interface didn't need much work, as I already had the beautiful design of the Pomodoro app we made in this module as a template. It was just a matter of "borrowing" the color palettes and a thing or two here or there (Picasso would be proud).

alt text

You can download it and test it out!

Maybe you'll find a couple of bugs (although I tried my hardest to break it!). I'd post the source code but wouldn't that take away from the fun of this challenge?

All of my thanks for this project go out to Craig Dennis, for making all of this possible, building large walls of understanding, and making learning great again (okay there was supposed to be a political joke around here somewhere, sorry). You are one amazing instructor and yes, I called my mom, dude (:

EDIT:

v1.2 is out, I managed to implement a mechanism to determine and print the correct (or correct-ish) number of significant decimal figures for your result; also input handling was significantly improved. Sweet.

EDIT 2:

It's on GitHub! Go see the source code here: https://github.com/do-adams/OpCalc

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

Hey Damian,

this is very impressive and cool !!!

Damian Adams
Damian Adams
21,351 Points

Grigorij Schleifer hey thanks, didn't think I'd find an anesthesiologist around these parts, cool!

Grigorij Schleifer
Grigorij Schleifer
10,365 Points

LOL !!!

Everyone needs a challenging hobby :smiley:

Gabe Nadel
seal-mask
.a{fill-rule:evenodd;}techdegree
Gabe Nadel
Treehouse Guest Teacher

Wonderful to see students helping each other go above and beyond like this. Kudos!

2 Answers

Impressive!