Skip to content

andwards/Postfix-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Postfix Calculator

This postfix calculator is a Java program that converts an infix expression to a postfix expression and evaluates the postfix expression. It provides a user-friendly interface for entering infix expressions and obtaining the corresponding postfix expression and result.

Usage

To use the postfix calculator, follow these steps:

  1. Enter an infix expression when prompted.
  2. The program will convert the infix expression to a postfix expression and display it.
  3. The program will evaluate the postfix expression and display the result.
  4. You will be prompted to enter another infix expression. If you choose to continue, repeat steps 1-3. Otherwise, the program will terminate.

Features

The postfix calculator offers the following features:

  • Infix to Postfix Conversion: The program converts an infix expression to a postfix expression using the Shunting-Yard algorithm. The conversion process handles parentheses, operators with different precedences, and operands.
  • Postfix Evaluation: The program evaluates the postfix expression using a stack-based approach. It supports the four basic arithmetic operations: addition, subtraction, multiplication, and division.
  • Input Validation: The program performs various checks to ensure that the input is valid. It verifies the presence of operands and operators, checks for mismatched parentheses, and detects illegal characters in the expression.
  • User Interaction: The program provides a user-friendly command-line interface for entering infix expressions and obtaining the results. It prompts the user for input and displays the postfix expression and evaluation result.

Contributors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages