Calculate Infix Expression of Calculation

Anonymous
timer Asked: Feb 6th, 2019
account_balance_wallet $9.99

Question Description

Create a class called 'Calculator' for infix expression calculation using the two-stack method as shown in class. This calculator should address the following:

  1. Use the stack template created in lab 2 for each of your stacks. Use the queue template of your lab 2b for any queue like functions that you may need.
  2. Perform the calculation by first changing the infix expression into post-fix expression. Output to the console the post-fix expression that was generated as well as the result of the expression.
  3. Then verify your result by repeating the process with converting to a pre-fix expression. Again, output the pre-fix expression to the console.
  4. Your main should allow the user to enter a mathematical expression of their choice.
  5. Assume the operands in the input expression will be any-size integer operands but successive operands/operators are separated spaces. Perform adequate expression verification to ensure that it is a well-formed expression before you perform the calculation. If it is mal-formed, inform the user accordingly.
  6. You should allow all binary arithmetic operators (+, -, *, /, %) and the parentheses.
  7. Unary operators (negation) in the input expression can be treated as illegal. Negative values calculated during the expression evaluation should be Ok.

Grading:

  • 5 pts - EXE works from command line on class/lab machines.
  • 3 pts - complete and working MSVC17 solution and proper styling.
  • 2 pts - Parsing the input expression to determine it is well-formed
  • 4 pts - Infix to postfix conversion and calculation
  • 4 pts - Infix to prefix conversion and calculation
  • 2 pts - Adequate demonstration of Stack ADT use in main.

This lab is due before class one week from today. As already explained, this assignment should be done in Visual Studio or properly changed into a Visual Studio format before submitting. Include your entire VS folder structure zipped as attachment to this question. The exe should work on its own before the coding will be graded. Also, include screenshots of the output. Remember to name your project and zip file name as ExpCalc_initial1_initial2. Put adequate documentation in code, including name blocks. Add the team member names in the response box of the question for the answer to be accepted.

Tutor Answer

jamila
School: Cornell University

Here...

flag Report DMCA
Review

Anonymous
Thanks, good work

Similar Questions
Related Tags

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors