Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Laboratory Exercise Script programs are useful for text processing involving many files. For instance, each subject may be associated with a file containing the students
Laboratory Exercise Script programs are useful for text processing involving many files. For instance, each subject may be associated with a file containing the students taking the subject and perhaps with assessment grades. Given a collection of such subject files, it is not difficult to find out the academic performance of a particular student and generate a transcript for that student. Write a bash shell script called transcript to search through a list of subject files and generate the transcript for one or more given students in the argument list. The first part of the argument list indicates the subject files to be used. This is followed by a special marker "student". Then a list of student ID follows. Each subject file starts with a line of 4 entries: the word "Subject", the subject code, the academic year and the semester that the subject is/was offered. Each of the subsequent lines contains the D of a student and the grade. For subjects in the current semester, there is no grade for the students. To facilitate the checking of students, there is a special file called student. dat. Each line of this file contains the ID of a student and the name. For simplicity, there are only two semesters in each academic year. You can assume that there is no error in the information contained in all the files. For instance, the program can be run like: transcriptCOMP101121S2.datCOMP241122S1.datstudent1234 Here, COMP101121S2 . dat and COMP241122S1. dat are the names of subject files, and 1234 is the D of the student whose transcript is to be generated. The two lists are separated by the special marker "student". The use of wildcard character " " can also be used in the list of subject files. However, it would not be used in the list of student ID. Typical file contents are shown below: Sample outputs (formatting is not important): Remember that your program is supposed to work on any correct datasets. As a result, you should not hardcode the subject file names in your script program. It is not required that you use the real data set for program development and testing. It would be easier if you use a small dataset for development and initial program testing. Requirements: 1. Elementary level: your script can read in the subject file data and echo the relevant information correctly. 2. Basic level: your script can produce the correct set of subjects and the associated information for one student. Subject ordering is unimportant. GPA calculation is not required. 3. Required level: your script can produce the correct set of subjects and the associated information for all students, with correct GPA calculation. If a student takes the same subject more than once, only the grade for the latest taking will be included in GPA calculation. If all subjects have no grade (i.e., current subjects), the GPA would be blank or unknown. You may round the GPA to two decimal places or truncate it at two decimal places, i.e., GPA for 7.7/3=2.566 can be displayed as either 2.57 or 2.56. 4. Bonus level: your script can accept the name of students besides the student ID and can check for potential students with the same name but different ID. For example, peter is a very common name among the students and you should display the transcripts of all peters. Please provide appropriate comments and check to ensure that your program can be executed properly under the Linux (apollo or apollo2) environment before submission. Name your program transcript (note that you cannot submit a file with extension .sh in BlackBoard for security reason) and submit it via BlackBoard on or before 24 February 2023. Hint: You can get the digits of the GPA with integer arithmetic through multiplying the numerator by 100. For example, GPA for john is 5.7/2=2.85 with floating point arithmetic, and the actual digits would be 570/2=285 using only integer arithmetic. The GPA can be displayed by printing the decimal point in the proper position, upon getting the first digit and the remaining digits via integer arithmetic
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started