Using Linux programing language: uestion1 In this case, you will use functions,
ID: 3589772 • Letter: U
Question
Using Linux programing language:
uestion1 In this case, you will use functions, looping structures, arrays, decision statements, calcu- lations, and other commands necessary to complete the following tasks: 1. Use an array to hold a student record with a name and three grades, for example: "Maude Tedders":100:88:90 2. Use the necessary commands to cut the fields into the name and grades fields 3. Use another array to contain the three grades. For example: Grade[ 1]-necessary statements to get the first grade Grade[ 2]-necessary statements to get the second grade Grade [3]=necessary statements to get the third grade 4. Take a numeric average of the three grades. 5. Convert the numeric average to a letter grade using this scale: A is 90 to 100 B is 80 to 89 C is 70 to 79 D is 65 to 69 F is 0 to 64 6. For each student record, display the student name, numeric average, and letter grade. 7. You must implement at least one function within the script. Create a file that contains at least five student records. Make them up. Provide the program output to demonstrate that your script worksExplanation / Answer
#!/bin/bash
inp = $1
while IFS=: read -d “:” -r f1 f2 f3 f4
do
sum=$((f3 + f2 + f4));
name=$f1;
if((sum <= 0))
then
continue;
fi
X=$((sum / 3));
if ((90<=X && X<=100))
then
Y=“A”
elif ((80<=X && X<=89))
then
Y=“B”
elif ((70<=X && X<=79))
then
Y=“C”
elif ((65<=X && X<=69))
then
Y=“D”
else
Y=“F”
fi
echo "$name has got marks $X with grade $Y";
done < "$1"
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.