This is for my linux class. §Write a script called activity4.2-1 in which you ta
ID: 3788076 • Letter: T
Question
This is for my linux class.
§Write a script called activity4.2-1 in which you take the student’s name and scores in 3 quizzes into the array quiz, then compute the average. The first element of the array (i.e. quiz[0]) would be the student full name.
The output of your script should look like below (note the presence of 2 decimal places):
Purpose: Computing Average using array
Name Quiz1 Quiz2 Quiz3 Average
Jon Doe 12 14 15 13.66
§Include a rst line that calls the sh as the interpreter
§Add a comment to state the purpose of the script and other comments to make the script easier to read
Explanation / Answer
echo " enter name:"
read name
echo "please enter Quiz1:"
read q1
echo "please enter Quize2:"
read q2
echo "please enter Quiz3:"
read q3
addthree='expr $q1+$q2+$q3'
average='expr $addthree /3'
echo " name Quiz1 Qui2 Quiz3 average"
echo $name $Quiz1 $Quiz2 $Quiz3 $average
comments:
echo is used to display on console
read is used to read input into variable
$=>is used to display a variable content to console
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.