0

datastructures, java ,stack

How can i read equations from a file and check if it is equal or not ex. 2*5+(10/2)=5*2+(5/1) (unspacific number of equations two in each line ) then convert each equation from infix to postfix and print it with its result to another file .

17th Apr 2020, 4:54 PM
Nada Kolaghaci
Nada Kolaghaci - avatar
1 Answer
+ 1
File operations: https://www.sololearn.com/learn/Java/2186/ ff. Read the whole line as a string and split it to two terms by the equality operator. Then parse each number and each operator, calculate both sides of the equation and compare the results. This task is not that easy. If you're unexperienced I'd recommend to focus on a simple equation first, e.g. only one side and only one operator and proceed step by step once this solution works.
3rd May 2020, 6:46 PM
Tashi N
Tashi N - avatar