Question
Here's the problem that I have to solve: Write a Java program that uses a Stack data structure to evaluate postfix expressions. Your program takes
Here's the problem that I have to solve:
Write a Java program that uses a Stack data structure to evaluate postfix expressions. Your program takes a postfix expression as an input,for example:3 42.3+ 5.25* ,from the user and calculates/display the result of the expression.
What I'm having trouble is getting it to reading and calculating it as postfix
Here's my code:
import java.util.Scanner; public class Assignment2 { public static void main(String[] args) {
Scanner scan = new Scanner(System.in); myStack
A separate class called MyStack:
import java.util.Stack; public class MyStack
Stack
Stack Interface class: public interface StackInterface
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