Explore BrainMass

Explore BrainMass

    Bash script to compute the letter grade from test scores

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    The Bash script must display the students letter grade based on the numeric average of combined test scores. The script should prompt user to enter numeric grades (test scores). Apply the loop structure to the portion of the script where the user is asked to enter the numeric grades. The script should also display the current date and time in Knoppix Linux.

    Update the given script for above requirements, and also give a pseudo code for the script logic.

    The appropriate letter grade for the number grade, should be computed using this scale:
    90 to 100: Display a letter grade of "A"
    80 to 89: Display a letter grade of "B"
    70 to 79: Display a letter grade of "C"
    65 to 69: Display a letter grade of "D"
    0 to 64: Display a letter grade of "F"

    © BrainMass Inc. brainmass.com October 9, 2019, 8:17 pm ad1c9bdddf


    Solution Preview

    The attached script 145964.sh reads 5 numeric grades one at a time, and rounds the average down or up to nearest integer value. For ex. "6 < avg < 6.5" will result in rounding down of avg to 6 and "6.5 <= avg < 7" will result in rounding up of avg to 7.

    Pseudo code for the script logic :

    1. Display welcome and other initial messages about the script.
    2. Display a message to enter 'Number of students' and read ...

    Solution Summary

    The Bash script in the solution uses a while loop to read numeric grades for the student. It also makes use of HERE document concept of shell scripting.