For your final Unix project, you will create a menu driven, user-friendly shell
ID: 3576240 • Letter: F
Question
For your final Unix project, you will create a menu driven, user-friendly shell script that allows a user to calculate the results for several common mathematical expressions. In each case, the script will prompt the user for the required input and the provide the output.
The mathematical expressions to be implemented include:
a. Slope of a line given two points (m = (y2-y1)/(x2-x1)
b. average for an undetermined number of input integers (avg = (x1+x2 + x3 + x4 ... +xn)/n
c. Simple interest (Interest = Principle * Rate * time in years)
d. Area of a rectangle (area = length * width)
e. Your mathematical formula
The script should use good design techniques including an easy-to-use interface, separation of functionality and be tested rigorously for logic and other errors.
Explanation / Answer
program in shell script:
clear
echo "Enter x2"
slope=`expr ($y2 - $y1) ($x2 - $x1)`
read l
read b
echo "The Area of Rectangle is: `expr $l * $b`"
;;
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.