Project 1
An RPN or Postfix Calculator

Due Date: Monday October 6, 2014; 11:59 p.m.


Write a working C++ program to function as a calculator. The input to your program will be an integer-based arithmetic expression. The output will be

The equivalent expression in postfix form.

The result from evaluating the postfix version of the expression.

The supported operators are: +, -, *, / (for div), % (for mod), and optionally parentheses. Unary operators are not included. (e.g. , "-") To input a negative value use a subtraction operaiton: (0 − 42)


Postfix calculators, rather famously, do not include an equals sign ("="). When the last input token is processed, the result of the expression is the value on the top of the stack - which should be output/displayed.


Any stacks or queues that your program makes use of should be implemented with linked lists.
When implementing these structures, you need to fully implment them (i.e. all the standard operations for each structure) instead of just those methods you need for this project.

You are to use your Bitbucket repository for this assignment.
1 Achievement Levels

Your work will be assessed from three different perspectives

Documentation of Code (15 points):
13-15: Your code follows the standards of the style guide. Furthermore, I am convinced that another student could follow your code and modify it if needed.

10-12: Your code is pretty well documented, though there are a couple of flaws.

7-9: Some portions are very well documented and others are not.

4-6: Major documentation flaws, but at least some attempt has been made.

0-3: If it was hard to program, it should be hard to read.



Efficiency and Style (10 points);
8-10: Style follows a consistent, readable model, as discussed in the style and coding guides. The code is as efficient as possible, within reason (e.g. uses a loop rather than repeated statements as much as possible, chooses the fastest or least space-consuming solution when possible). Functions are not huge and tasks are divided well among various classes.

5-7: Some style or efficiency problems, but overall very easy to read and reasonably efficient.

3-4: Several problems in style or efficiency.

1-2: Code is hard to read or style is very inconsistent.

0: Even you can't explain your code.



Correctness (75 points):
F Level (0-34): Code does not compile or crashes when run. Variant points awarded based on quality of analysis of the problem with the code.

D Level (35-44): Code compiles and runs without crashing. Successfully implements both a linked list stack and queue.

C Level (45-54): Code compiles and runs without crashing. Implements the D-Level in addition to a Postfix-Calculator implementing driver. This is a driver program that accepts from the user an expression in postfix notation and outputs the result from evaluating the expression.

B Level (55-59): Code compiles and runs without crashing. Implements the C-Level in addition to performing the infix notation to postfix notation conversion, exclusive of parentheses.

B+/A- Level (60-67): Implements the use of parentheses in the infix notation input.

A Level (68-75): Here is your chance to be creative. To achieve this level, your need to implement the B+/A- Level plus some enhancement of your own design. Some examples of this include:
Additional unary operators: factorial, square root, negative input values, etc.

Instead of base ten, your calculator operates using some other system: e.g. Roman numerals, hexadecimal.

Input error checking: insure the input infix expression is "well formed" and legal.

Be creative and come up with your own enhancements. The above are suggestions meant to trigger your creativity, insead of a "pick one of the above to get an A."

    • 12 years ago