ReversePolishCalculator - File Author Wayne...

This preview shows page 1 - 2 out of 3 pages.

/* File: ReversePolishCalculator * Author: Wayne Snyder ([email protected]) * Modified by: Mithali Shenoy ([email protected]) * Date: 9/20/2011 * Class: CS 112, Summer Term 01, 2013 * Assignment: HW 02 * Purpose: This is a prototype of a program to evaluate Reverse Polish Expressions; the * assignment is to take this clunky, static code, and turn it into a reasonable object-oriented * program. * Platform: This was developed on Mac OS X 10.6.5 in Dr. Java * * Known bugs: This does not check for stack underflow when there are not enough operands, and does * not check for incorrect form of input * */ import java.util.*; public class ReversePolishCalculator{ public static void main(String[] args) { SymbolTable T = new SymbolTable(); // Symbol table: vars are letters, so stored values in location corresponding Stack S= new Stack(); // Evaluation stack int cmd; // numeric command char cmd2; // token read as part of command int result=0; // variable initialized as the result of the equation in putted by user Scanner sc = new Scanner(System.in); System.out.println("Reverse Polish Calculator"); System.out.println("What would you like to do, assign a variable (1),
Image of page 1

Subscribe to view the full document.

Image of page 2
  • Spring '13
  • DaveSullivan
  • Algebra, Forth, Array data structure, Reverse Polish notation, Stack-oriented programming language, //print stack contents

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern