Logo 
Search:

Unix / Linux / Ubuntu Forum

Ask Question   UnAnswered
Home » Forum » Unix / Linux / Ubuntu       RSS Feeds

shell script program

  Asked By: Leon    Date: Jul 24    Category: Unix / Linux / Ubuntu    Views: 2058
  

i am new to linux. I have to come up with a shell script that gets 10 test scores and calculates the avg, the highest and lowest score, as well as calculate the new avg if i remove the lowest test grade. I also have to convert the test avg to letter grade. This is what i have thus far (i am stuck) can anyone help me?


Name of script: Grade_Assignment
#=====================================================
#read ten numbers and assigned them to 10 variable


read -p "Enter test score one : " n1
read -p "Enter test score two : " n2
read -p "Enter test score three : " n3
read -p "Enter test score four : " n4
read -p "Enter test score five : " n5
read -p "Enter test score six : " n6
read -p "Enter test score seven : " n7
read -p "Enter test score eight : " n8
read -p "Enter test score nine : " n9
read -p "Enter test score ten : " n10

#=====================================================
((test=$n1+$n2+$n3+$n4+$n5+$n6+$n7+$n8+$n9+$n10))

((avg=test/10))
#=====================================================
# CONVERT AVERAGE TO LETTER GRADE
#=====================================================
if ((avg>=90))
then
grade="A"
echo "Outstanding job."
elif ((avg>=80))
then
grade="B"
echo "Good job"
elif ((avg>=70))
then
grade="C"
echo "You passed, but keep practicing"
elif ((avg>=65))
then
grade="D"
else
grade="F"
fi
#========================================================
echo "Your overall average is:" $avg
echo "Your overall grade is an:" $grade
echo "That's all folks, see you next script."

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on shell script program Or get search suggestion and latest updates.




Tagged: