Skip to content

Latest commit

 

History

History
75 lines (57 loc) · 2.93 KB

README.md

File metadata and controls

75 lines (57 loc) · 2.93 KB

RPN(reverse polish notation) calculator

This is command-line calculator which supports 4 basic arithmetic operations(+ - * /). Implemented as part of Svitla Systems, Inc. interview "home work".

Requirements

  1. The calculator should use standard input and standard output
  2. It should implement the four standard arithmretic operators
  3. The calculator should handle errors and recover gracefully
  4. The calculator should exit when it receives a q command or an end of input indicator (EOF / Ctrl+D)

Technical decisions

I identified that project should be "interactive cli application" which means run once and make a dialog. So I had to skip following libraries:

  1. commons-cli - doesn't support interactive cli
  2. picocli - the same:
    1. one tutorial
    2. another tutorial

Also there were applicable libs:

  1. Spring Shell - requires deep investigation to customize for my needs
  2. picocli-shell-jline3 - looks complicated in code

A high-level description of your solution Reasoning behind your technical choices, including architectural Trade-offs you might have made, anything you left out, or what you might do differently if you were to spend additional time on the project How to run your code, if applicable Link to the hosted application, if applicable

STORY: not used commons-cli(not interactive): http://zetcode.com/java/console/ not used picocli(same):

Installation

Application requires Java 8 to build.

Clone code from GitHub, make sure you have some JRE/JDK installed and build the project:

$ cd rpn_calculator
$ sh gradlew clean build jar

Usage

Application requires Java 8 to run.

$ cd rpn_calculator/build/libs
$ java -jar rpn_calculator-1.0-SNAPSHOT.jar
$ > 1 1 +

Hints!

  1. use CTRL+D or q commands to exit application interactive mode
  2. use -help for some help

License

GNU GPL v3

Links: