Question
Below is the java code to solve an equation, the only thing I want in it is to ask the user to enter input and
Below is the java code to solve an equation, the only thing I want in it is to ask the user to enter input and then the program will solve the equation. Thanks.
THE CODE IS BELOW......
import java.util.Stack;
public class Equation { public static void main(String[] args) { String expression = "(2+3)*(8-4)*(5-3)"; int output = evaluate(expression); System.out.println("Expression: "+expression); System.out.println("Output: "+output); } public static int evaluate(String expression) { char[] tempTokens = expression.toCharArray(); char[] tokens = new char[tempTokens.length*2]; int count = 0; for (int i=0;i Stack Stack
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started