Coder Social home page Coder Social logo

cli-rpn-calculator's Introduction

Table of Contents
  1. About The Project
  2. Getting Started

About The Project

This product is a command-line interface for an RPN Calculator. Reverse Polish Calculators are different from standard calculators, in which operators follow their operands. For example, "3 2 +" equates to "5" in an RPN calculator.

This product enables arithmetic calculations with two operands and four basic operations (addition, subtraction, multiplication, and division).

Technical Choices

The backbone of the product in terms of data structure is the "stack", where its LIFO (Last In Frist Out) concept perfectly aligns with the RPN logic.

In terms of data validation, "Regex" (Regular expression) is used to simply validate the user input against the currently available operators.

The Node.js "stream" interface (more specifically "readline" module) is used to enable future scalability of the product. The current "readable" and "writable" streams can conveniently be changed to work with the local file system through the "fs" native module. Moreover, the "duplex" stream can be used to enable the "TCP socket" interface.

Stretch Features

There are a few items that can be added to further improve the product:

  • Add additional unit tests to increase the test code coverage as well as to include the asynchronous callbacks.
  • Implement integration tests to ensure the full functionality of the child processes in the command line.
  • The current product only accepts two-operand calculations. Expand the code to include uni-operand calculations.

Getting Started

To start the application, simply run "node index.js" command from the directory. To run the tests, run "npm run test".

cli-rpn-calculator's People

Contributors

skahrobaei avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.