辅导CST 8102、讲解Linux VM、辅导C/C++语言、讲解C/C++程序
调试Matlab程序|讲解数据库SQL
CST 8102
Lab 8 - myGrade.sh
Only complete this lab if your student number is even
Introduction to scripting
Write the following script using the Linux VM and vi (or vim) as the editor.
Create a script called myGrade.sh that will calculate the final grade, and display the letter grade for a
course. Use only integers for input.
The first line of the script must force the use of the bash shell.
The next lines of the script must contain the following comments.
student name
student number
course
either course section, or lab date and time
a description of the script and its' purpose
1. Prompt the user to enter marks for the following grade items.
Assignments (from 0 to 40)
Test 1 (from 0 to 15)
Test 2 (from 0 to 15
Final Exam (from 0 - 30)
2. It is not required to test for invalid input. Assume that all values entered are integers, and are
within the requested range of values.
3. Calculate the final grade numeric value by adding the four input values.
4. Convert the numeric grade to a letter grade using the table below.
Number Grade Letter Grade
90 - 100 A+
85 - 89 A
80 - 84 A-
77 - 79 B+
73 - 76 B
70 - 72 B-
67 - 69 C+
63 - 66 C
60 - 62 C-
57 - 59 D+
53 - 56 D
50 - 52 D-
0 - 49 F5. Display the final numeric and final letter grades. The script output format must match the
following sample output format. User input values are in red.
Enter Assignment mark (0 - 40): 25
Enter Test 1 mark (0 - 15): 8
Enter Test 2 mark (0 - 15): 10
Enter Final exam mark (0 - 30): 24
Your final numeric grade is 67, and your final letter grade is C+
6. Upload the file to BrightSpace. Do not zip the file.
- QQ:99515681
- 邮箱:99515681@qq.com
- 工作时间:8:00-21:00
- 微信:codinghelp
联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!