Skip to content

Equinox2121/Java-RPN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Reverse Polish Notation (RPN) Calculator (Java)

A console-based RPN calculator written in Java using a custom Stack ADT. This project was created for an academic assignment to demonstrate manual stack implementation, parsing input expressions, and implementing an RPN Calculator.

Assignment Overview

The goal of this project is to evaluate mathematical expressions written in Reverse Polish Notation (RPN).
The calculator reads input from the console, processes numbers and operators using two stacks, computes the result, and prints the final output.
It continues to run until the user stops the program manually.

Supported Operations

Operator Function
+ Addition
- Subtraction
* Multiplication
/ Division (safe with zero-check)
% Modulus

Error Handling

  • Invalid token detection
  • Insufficient operand/operator warning
  • Division by zero prevention
  • Program continues after errors

Stack<E> Class

Custom generic stack with:

  • Push(E value)
  • Pop()
  • Peek()
  • Length()
  • isEmpty()
  • invert()

About

Console-based Java Reverse Polish Notation (RPN) calculator using a custom stack implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages