Skip to content

A user-friendly expression evaluator that handles binary operations that is implemented using good programming practices that promote extensibility and embraces encapsulation. A GUI was implemented as well.

Notifications You must be signed in to change notification settings

FerasAlazzeh/Calculator-With-GUI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Calculator-with-GUI

  • Overview

I built a calculator that carries out binary operations by utilizing the power of a inheritance, abstract classes, and polymorphism. Dynamic Binding makes this program very flexible incase more operations were to be added in the future.

  • Implementation Details

I created multiple classes to mirror different operations such as addition, subtraction, division, multiplication etc. I used a hash map to store these classes and create instances of these classes whenever I detected specific tokens inputted such as “+”,“-“,”/”,”*”, etc. Then using a basic while loop I pushed operators and operands onto their respective stacks while making sure I stayed mindful of the order of operations. While pushing Operators and Operands onto their respective stacks I am calling each Operator's execute method utilizing polymorphism. Implementing parenthesis was similar. I pushed an object for an open parenthesis that was just an identifier. Then when I detected a close parenthesis I would solve everything up until the open parenthesis identifier.

  • Class Diagram

I attached a Class Diagram to help further explain the Implementation Details.

About

A user-friendly expression evaluator that handles binary operations that is implemented using good programming practices that promote extensibility and embraces encapsulation. A GUI was implemented as well.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages