Operating-Systems

Tasks studies - laboratory

View project on GitHub

Multi-function calculator

This project is a simple script written in bash that works as a multi-function calculator. The script offers various functions such as addition, subtraction, multiplication, division, calculating the average, calculating the areas and perimeters of geometric figures, the Pythagorean theorem and calculating delta with zeros.

How to use the calculator?

After running the script, a menu with various program options is displayed. Select the number corresponding to the desired function. The script then guides the user through the appropriate steps, such as entering data and calculating the result. In case of incorrect data entry, the script will inform the user about the error.

Calculator functions

  • Calculator: Allows you to perform basic math operations such as addition, subtraction, multiplication and division. The user enters numbers and selects an operation, and the script calculates the result.

  • Calculating the average: Allows you to calculate the average of the given numbers. The user enters the number of numbers and then enters the numbers themselves. The script calculates the average of these numbers and displays the result.

  • Areas and perimeters: Allows you to calculate the areas and perimeters of various geometric figures such as square, rectangle, triangle, rhombus, parallelogram and circle. The user selects a figure, provides the appropriate dimensions, and the script calculates the area and/or perimeter for a given figure.

  • Pythagorean Theorem: Allows you to calculate the length of the third side of a right triangle when the lengths of the two legs are known. The user enters the lengths of the legs, and the script calculates the length of the third side.

  • Calculating delta and zeros: Allows you to calculate the delta and zeros of a quadratic equation. The user enters the coefficients of the equation and the script calculates the delta and displays the zeros, if any.

##Running the script The script can be run in a Unix or Linux environment using the bash interpreter. Just type ./scriptname.sh in the terminal and the script will start running.

Requirements

  • Bash interpreter

Comments

This script was written for educational purposes as a simple multi-function calculator. May contain limitations and does not cover all cases.