Skip to content

optmsp/learn-by-calculators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Goal

Learn some new languages by creating calculators.

Overview

We'll start with a basic calculator (add, subtract, multiply, divide). Over time, we'll do scientific, financial, and then graphing calculators.

Requirements

Phase 1: Basic Needs

  • Basic Operations: The calculator must perform the four fundamental arithmetic operations: addition, subtraction, multiplication, and division.
  • Result Display: After computing the result, the calculator should display it clearly and then prompt the user for another input. This allows for continuous use until the user decides to exit.
  • Exit Capability: Users should be able to exit the program using a specific command (e.g., 'exit' or 'quit').
  • Error Handling: Implement basic error handling for unexpected or malformed inputs to prevent the program from crashing.
  • Instructions for Use: When the program starts, it should display instructions on how to use the calculator, including the format of the input and how to exit.

Phase 2: Testing

  • Unit Testing: Provide unit testing for each tool/language.

Phase 3: Expanded Features

  • Handling Division by Zero: The program should handle attempts to divide by zero appropriately, providing an error message instead of crashing or producing a nonsensical result.
  • Repeat Calculations: The calculator should allow users to perform multiple calculations sequentially without needing to restart the program.
  • Enhanced Console UI: Provide a cleaner UI with support for arrow keys, etc.
  • User Input Validation: The program should validate user inputs to ensure they are numerical values where expected and handle non-numerical inputs gracefully, either by rejecting them or by displaying an error message.
  • Floating Point Arithmetic: The calculator should support floating-point arithmetic to allow for more precise calculations with decimals.
  • Variables: Support for variables, e.g., A=1, B=1+A ... displays: 2

Phase 4: Web Server

  • Web Interface: Should provide a basic HTTP server that accepts input and responds with the calculator result.
  • Unit Testing: Unit testing should be updated.
  • UI Testing: UI testing to ensure proper handling of input, etc.

Languages

Language Phase 1 Phase 2 Phase 3 Phase 4
Python x
Ruby
C#
JavaScript
Java
Go/Golang
Swift
Kotlin
C
C++
x86 ASM

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages