Skip to content

Latest commit

 

History

History
35 lines (21 loc) · 1.66 KB

README.md

File metadata and controls

35 lines (21 loc) · 1.66 KB

#This is my submission of the "calculator" the first assignment of the Sacramento Ruby beginners meetup.

Project

Build a simple, command-line driven RPN (HP style) calculator

Original Requirements

Runs in a continuous loop until encountering the "q" (quit) command. It waits for input, and you enter either a digit or an operation, then press enter. The calculator will print out the current value, or an error message if something went wrong. The operations that will be supported are addition (+), subtraction (-), multiplication (*) and division (/). Pressing enter with no input just prints the prompt. Pressing "m" prints out the current memory stack. Pressing "c" (clear) will clear memory

Extra Credit Assignments

  • Create a "paper tape" function "p" that prints out the history of all input including operators. "c" does not clear history.
  • Add a clear all function that clears both.
  • Add support for entering floating point numbers.
  • Add a "pi" command that adds "Pi" to stack.
  • Add square root "sqrt".

Extra Extra Credit Assignments

  • Save memory and history to a file, and read it in when the program is started

TODO

  • Everything above

Done

  • Nothing

Files

  • README.md = Is the readme which is info about this project and its code, contains what you read now
  • calculator.rb = The main calculator program, written entirely by me using the Ruby programming language
  • calculator-ORIGINAL.rb = Is the original code example, I could have built off this example to complete the "extra" and the "extra extra" credit assignments but since the main objective is to learn Ruby and ultimately learn how to program I figured it be best to start from scratch.