Question: Please help me solve this. I need the answer write in shellscript ( bash) the sample output are on the below COMP 4321 2019 4

Please help me solve this. I need the answer write in shellscript ( bash)

the sample output are on the below

Please help me solve this. I need the answer write in shellscript

( bash) the sample output are on the below COMP 4321 2019

4 Laboratory Exercise Script programs are useful for text processing involving many

COMP 4321 2019 4 Laboratory Exercise Script programs are useful for text processing involving many files. Write a bash shell script called transcript to input the grades of subjects and generate the transcript(s) for student(s), based on the GPA system. Compute the GPA to two decimal places. The results of all students for a subject are stored in a text file, e.g. COMP1234-2020.txt stores the grades of students taking the subject COMP1234 in academic year 2020/2021. The first line contains information about the subject. Each subsequent line contains the name of a student and the grade. All subjects carry 3 credits, unless specified otherwise inside the score file. For simplicity, you can assume that all students have different names and that each subject is only offered once per academic year. Furthermore, there is no error in the information contained in each file. In other words, all grades are correct. You can also assume that all score files are placed in the same directory as the script program and that there are no other text files. For instance, the program can be run like: transcript david The GPA for david can be computed after generating the transcript. Some typical file contents for this lab exercise are shown below. You are to create your own input testing files for your script program, since the contents in the files below are rather minimal. Filename Content comp1111-2019 COMP1111 2019 peter B+ mary A david c COM comp2345-2018 COMP2345 2018 peter D+ F comp2345-2019 COME COMP2345 2019 B peter B+ alanc alan mary david B comp 4321-2019 david B alan D comp 4321-2020 mary B+ COMP 4321 2020 4 alan C- peter A- The output of your program on generating the transcript for david would look like this, after processing all the 5 grade files above. Transcript for david Year Subject Credit Grade GP 2019 COMP1111 3 C 6.0 2019 COMP2345 3 B 9.0 2019 COMP 4321 4 B 12.0 Credits 10 GPA 2.70 There could also be more than one student in the argument list. It is quite easy to extract the argument list from the script execution line. For example, running the following script for the transcripts of 3 students will generate outputs as shown. transcript mary peter alan Transcript for mary Year Subject Credit Grade GP 2019 COMP1111 3 A 12.0 2019 COMP2345 3 B 9.0 2019 COMP 4321 4 B+ 14.0 Credits 10 GPA 3.50 Transcript for peter Year Subject Credit Grade GP 2018 COMP2345 3 D+ 4.5 2019 COMP1111 3 B+ 10.5 2019 COMPp2345 3 B+ 10.5 retake 2020 COMP4 321 4 A- 14.8 Credits 10 GPA 3.58 Transcript for alan Year Subject Credit Grade GP 2018 COMP2345 3 F 0.0 2019 COMP2345 3 C 6.0 retake 2019 COMP 4321 4 D 4.0 2020 COMP 4321 4 C- 6.8 retake Credits 7 GPA 1.83 Finally, in the absence of any argument, the transcripts for all students will be generated. transcript Transcript for alan Year Subject Credit Grade GP 2018 COMP2345 3 F 0.0 2019 COMP2345 3 C 6.0 retake 2019 COMP 4321 4 D 4.0 2020 COMP 4321 4 C- 6.8 retake Credits 7 GPA 1.83 Transcript for david Year Subject Credit Grade GP 2019 COMP1111 3 C 6.0 2019 COMP2345 3 B 9.0 2019 COMP 4321 4 B 12.0 Credits 10 GPA 2.70 Transcript for mary Year Subject Credit Grade GP 2019 COMP1111 3 A 12.0 2019 COMP2345 3 B 9.0 2019 COMP 4321 4 B+ 14.0 Credits 10 GPA 3.50 Transcript for peter Year Subject Credit Grade GP 2018 COMP2345 3 D+ 4.5 2019 COMP1111 3 B+ 10.5 2019 COMPp2345 3 B+ 10.5 retake 2020 COMP4321 4 A- 14.8 Credits 10 GPA 3.58 Requirements: 1. Elementary level: your script can read in the grades and generate the list of subjects taken by that one student in the argument in certain order with certain information. 2. Basic level: your script can compute the correct GPA to any number of decimal places when there is no retake and the subjects taken by that one student are all 3-credit subjects graded under either the old or the new grading system entirely, instead of a mixed system. 3. Required level: your script can compute the correct GPA to two decimal places in the presence of retakes and varying number of credits, sorted in proper order under the : grading system: subjects taken in academic year 2019/2020 or before will be graded under the old system (from A+ to F for GP of 4.5 to 0, without any A-/B-/C- grades) and subjects taken in academic year 2020/2021 or after will be graded under the new system (from A+ to F for GP of 4.3 to 0, with the presence of A-/B-IC-grades). 4. Bonus level: your script is able to handle certain non-trivial types of errors and take appropriate actions against them. Please provide information about your approach and explain briefly. COMP 4321 2019 4 Laboratory Exercise Script programs are useful for text processing involving many files. Write a bash shell script called transcript to input the grades of subjects and generate the transcript(s) for student(s), based on the GPA system. Compute the GPA to two decimal places. The results of all students for a subject are stored in a text file, e.g. COMP1234-2020.txt stores the grades of students taking the subject COMP1234 in academic year 2020/2021. The first line contains information about the subject. Each subsequent line contains the name of a student and the grade. All subjects carry 3 credits, unless specified otherwise inside the score file. For simplicity, you can assume that all students have different names and that each subject is only offered once per academic year. Furthermore, there is no error in the information contained in each file. In other words, all grades are correct. You can also assume that all score files are placed in the same directory as the script program and that there are no other text files. For instance, the program can be run like: transcript david The GPA for david can be computed after generating the transcript. Some typical file contents for this lab exercise are shown below. You are to create your own input testing files for your script program, since the contents in the files below are rather minimal. Filename Content comp1111-2019 COMP1111 2019 peter B+ mary A david c COM comp2345-2018 COMP2345 2018 peter D+ F comp2345-2019 COME COMP2345 2019 B peter B+ alanc alan mary david B comp 4321-2019 david B alan D comp 4321-2020 mary B+ COMP 4321 2020 4 alan C- peter A- The output of your program on generating the transcript for david would look like this, after processing all the 5 grade files above. Transcript for david Year Subject Credit Grade GP 2019 COMP1111 3 C 6.0 2019 COMP2345 3 B 9.0 2019 COMP 4321 4 B 12.0 Credits 10 GPA 2.70 There could also be more than one student in the argument list. It is quite easy to extract the argument list from the script execution line. For example, running the following script for the transcripts of 3 students will generate outputs as shown. transcript mary peter alan Transcript for mary Year Subject Credit Grade GP 2019 COMP1111 3 A 12.0 2019 COMP2345 3 B 9.0 2019 COMP 4321 4 B+ 14.0 Credits 10 GPA 3.50 Transcript for peter Year Subject Credit Grade GP 2018 COMP2345 3 D+ 4.5 2019 COMP1111 3 B+ 10.5 2019 COMPp2345 3 B+ 10.5 retake 2020 COMP4 321 4 A- 14.8 Credits 10 GPA 3.58 Transcript for alan Year Subject Credit Grade GP 2018 COMP2345 3 F 0.0 2019 COMP2345 3 C 6.0 retake 2019 COMP 4321 4 D 4.0 2020 COMP 4321 4 C- 6.8 retake Credits 7 GPA 1.83 Finally, in the absence of any argument, the transcripts for all students will be generated. transcript Transcript for alan Year Subject Credit Grade GP 2018 COMP2345 3 F 0.0 2019 COMP2345 3 C 6.0 retake 2019 COMP 4321 4 D 4.0 2020 COMP 4321 4 C- 6.8 retake Credits 7 GPA 1.83 Transcript for david Year Subject Credit Grade GP 2019 COMP1111 3 C 6.0 2019 COMP2345 3 B 9.0 2019 COMP 4321 4 B 12.0 Credits 10 GPA 2.70 Transcript for mary Year Subject Credit Grade GP 2019 COMP1111 3 A 12.0 2019 COMP2345 3 B 9.0 2019 COMP 4321 4 B+ 14.0 Credits 10 GPA 3.50 Transcript for peter Year Subject Credit Grade GP 2018 COMP2345 3 D+ 4.5 2019 COMP1111 3 B+ 10.5 2019 COMPp2345 3 B+ 10.5 retake 2020 COMP4321 4 A- 14.8 Credits 10 GPA 3.58 Requirements: 1. Elementary level: your script can read in the grades and generate the list of subjects taken by that one student in the argument in certain order with certain information. 2. Basic level: your script can compute the correct GPA to any number of decimal places when there is no retake and the subjects taken by that one student are all 3-credit subjects graded under either the old or the new grading system entirely, instead of a mixed system. 3. Required level: your script can compute the correct GPA to two decimal places in the presence of retakes and varying number of credits, sorted in proper order under the : grading system: subjects taken in academic year 2019/2020 or before will be graded under the old system (from A+ to F for GP of 4.5 to 0, without any A-/B-/C- grades) and subjects taken in academic year 2020/2021 or after will be graded under the new system (from A+ to F for GP of 4.3 to 0, with the presence of A-/B-IC-grades). 4. Bonus level: your script is able to handle certain non-trivial types of errors and take appropriate actions against them. Please provide information about your approach and explain briefly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!