Postfix notation, is a mathematical notation in which operators follow their operands; for instance, to add 3 and 4, one would write 3 4 + rather than 3 + 4 (infix notation). If there are multiple operations, operators are given immediately after their second operands; so, the
expression written 3 − 4 + 5 in conventional notation would be written 3 4 − 5 + in postfix notation: 4 is first subtracted from 3, then 5 is added to it. An advantage of postfix notation is that it removes the need for parentheses that are required by infix notation. While 3 − 4 × 5 can also be written 3 − (4 × 5), which is different from (3 − 4) × 5. In postfix notation, the former could be written 3 4 5 × −, while the latter could be written 3 4 − 5 × or 5 3 4 − ×. (from Wikipedia)
Stacks can be used to evaluate expressions in postfix notations by following these steps:
If a number is typed, push it on the
If an operation is typed, depending on the operation, pop off two numbers from the stack, perform the operation, and push the result back on the
You should complete the Stack class and other functions in the template file (found on Carmen) so that when the user enters an expression in postfix notation, the program calculates and shows the result. In this assignment the user enters one-digit positive numbers only, but the result can be any integer. Only basic operations (i.e. +, -, /, *) are entered by the user and integer division is used in calculations. User input ends with a semicolon.
Class Stack uses a linked list to implement a stack, and it has five public member functions:
Default constructor: initializes the stack to an empty stack
isEmpty: returns true if the stack is empty and false otherwise
push: pushes a new number to the top of stack
pop: removes the top of stack
top: returns the value at the top of stack, does not remove it from stack
You must use the template file and only add you code were you see /*your code here*/. Do not modify other parts of the code. Do not use C/C++ libraries other than iostream and cstdlib.
Input/Output example
Your output must match the solution file on Carmen exactly. Following are some example test cases and their expected outputs. User input is underlined.
Program Submission
Your submission files must have the following at the top:
/*
File name: (your file name) Created by: (your name) Created on: (date)
Synopsis: (what your program does)
*/
Compile your code in CSE stdlinux system with this command:
g++ homework4.cpp -std=c++11 –pedantic-errors
Program does not compile in CSE stdlinux system using the above command will receive a zero.
Make sure your code is formatted properly. Your program should have appropriate indention and necessary comments. See textbook on section 2.5 or any code example in textbook/lecture slides.
Submit your code to the designated dropbox on Carmen. You can find the dropbox under the Assignments tab.
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme