1.Learning Objectives:

  • Use Stack data structure to solve problems
  • Use java.util.Stack class or implement own Stack class
  • Convert infix expressions to postfix expressions
  • Evaluate postfix expressions
  • Define classes and create driver class to test the class definitions
  • Write a complete program to evaluate infix expressions

2.General Descriptions:

The program prompts and reads an infix expression; evaluates the express and displays the result. It assumes that the infix expression is a valid expression which might has integers, parenthesis and operators +, -, *, /. The division is integer division.

3.Requirements:

  • Create a class that can convert an infix notation to a postfix notation.
  • Create a class that can evaluate the postfix notations.
  • Create a driver class that prompts and reads an infix expression and display the value of the expression.

4.References:

  • Koffman & Wolfgang, Data Structures: Abstraction and Design Using Java, 2nd Edition: Pages 170-188.
  • Lecture notes.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.