[SOLVED] SOLVED:Lab 4

29.99 $

Lab 4 (10 points) Write a program that uses stacks to evaluate valid prefix and postfix arithmetic expressions. Use either the Java API Stack class or one of the textbook implementations. An algorithm to evaluate postfix expression is given in your notes and in the book; you will have to devise your own prefix algorithm. The program should: – present the user with each option (prefix or postfix) – prompt for an expression of the chosen type – verify that the expression is properly formed – present the solution – give the user the opportunity to quit or start over Extra credit options: 5 points: implement the algorithm found in the book and in the notes to convert an infix expression to postfix, then evaluate the expression (this option should then be included in the initial menu presented to the user) 5 points (each): Before presenting the solution, show the pre- or post-fix expression in infix form, parenthesized as necessary.

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

rar file icon Lab4.rar (10.1 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
Rate this product

Lab 4 (10 points) Write a program that uses stacks to evaluate valid prefix and postfix arithmetic expressions. Use either the Java API Stack class or one of the textbook implementations. An algorithm to evaluate postfix expression is given in your notes and in the book; you will have to devise your own prefix algorithm. The program should: – present the user with each option (prefix or postfix) – prompt for an expression of the chosen type – verify that the expression is properly formed – present the solution – give the user the opportunity to quit or start over Extra credit options: 5 points: implement the algorithm found in the book and in the notes to convert an infix expression to postfix, then evaluate the expression (this option should then be included in the initial menu presented to the user) 5 points (each): Before presenting the solution, show the pre- or post-fix expression in infix form, parenthesized as necessary.

  • Lab4.rar