Skip to content

this program takes a mathematical expression and calculates result step by step.

Notifications You must be signed in to change notification settings

mohamad-khorsandi/mathematical-expression-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

this program takes a mathematical expression and calculates result step by step.

it supports:

  • integer and floating point numbers
  • + - / * ^ ( )
  • sin(), cos(), tan(), cot(), ln(), e(), log(), abs(), other function can be added easily

input 1:

e(sin(1+3) * log(2^2))

output 1:

0.6340417317497135

input 2:

-(-(2^3))/4+1 

output 2:

  3

input 3:

-(((1+2)*(-3))^(1+1)) 

ouput 3:

-81

input 4:

((1.4+1.6)*10)/100 

output 4:

0.3

some errors will be detected by program such as wrog use of parentheses and more. hree is some inputs that cause erorr:

)(1+3)*2
(((2+5)^2)+4
3+5^
+5^
5/0

for each expression, a cli version of expression-calculate-tree will be printed:

tree

  • compile(linux):
find -name *.java > src.txt
javac -d out/ @src.txt
  • run:
cd out
java com.company.Main

About

this program takes a mathematical expression and calculates result step by step.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages