Project

Simple Calculator

Hard
220 completions
~ 8 hours
4.1

Get more familiar with basic bash commands. Work with variables, the user input, arithmetic operators, conditional statements, functions, arrays, regex, and the bc utility, which stands for Basic Calculator.

Provided by

JetBrains Academy JetBrains Academy

About

A long time ago ancient people used fingers to calculate. Of course, this method had certain limitations. The abacus was invented to fill in the gap. Four hundred years ago, Wilhelm Schickard, a German astronomer, invented one of the first calculating machines. Another inventor, Thomas de Colmar, created Arithmometer in 1820. It was the first commercial calculator. We are very lucky, though. We got bash to do calculations. In this project, you will learn to create a simple calculator with bash.

Training project icon

Training project

This project allows you to practice and strengthen your coding skills, helping you get ready for more advanced tasks ahead.

What you'll learn

Once you choose a project, we'll provide you with a study plan that includes all the necessary topics from your course to get it built. Here’s what awaits you:
Learn how to carry out simple arithmetic operations in bash.
Let's turn to more complex arithmetic operations and learn how to handle the bc utility.
Add more functionality to your program. Welcome users and ask whether they want to quit or do some calculations. Also, save the calculation history into a file.

Reviews

Klekovkina Alena avatar
Klekovkina Alena
5 months ago
This project teaches how to build an interactive terminal application that prompts the user, processes input, and exits gracefully with commands like "quit". It introduces input validation using regular expressions, arithmetic using external tools like bc, and file handling for logging. You'll also ...
Mauro Gonçalves avatar
Mauro Gonçalves
6 months ago
During this project, I've gained valuable experience with Bash scripting and command-line application development. I learned how to create an interactive calculator that handles both integer and floating-point operations, including addition, subtraction, multiplication, division, and exponentiation.
Anastasiya Mostovaya
7 months ago
I learned how to validate input and perform arithmetic operations in Bash, including floats and exponentiation. The main challenge was handling input formatting correctly. This project improved my scripting and debugging skills.

4.1

Learners who completed this project within the Introduction to Command Line and Unix Shell course rated it as follows:
Usefulness
4.3
Fun
4.0
Clarity
4.0