School of Computer Science, McGill University COMP-206 Introduction to Software Systems, Winter 2021 Final Project Due Date April 29, 14:00 EST This is an individual assessment. You need to solve...

1 answer below »
Project Synopsis: For this project, you will implement a software solution that consists of shell scripts and C program to compute the lab attendance associated with each student.
Detailed step-by-step instructions in attached PDF fileWill provide login info to the server in which the assignment will be done.


School of Computer Science, McGill University COMP-206 Introduction to Software Systems, Winter 2021 Final Project Due Date April 29, 14:00 EST This is an individual assessment. You need to solve these questions on your own. Instructors and TAs will only provide clarifications on the exam questions and it will be through Piazza. There will be no help provided to debug your project code. This is your final work, and it also requires you to demonstrate that you have learned the necessary debugging skills. Obtaining a minimum of 50% in this project is mandatory to pass the course (in addition to ob- taining an overall passing grade across all the course assessments). Students who do not achieve that threshold will receive an F grade. NO LATE submissions are accepted. Please account for Internet delays, outages, etc., and turn in your work in due time. These are not valid excuses for extensions. This project description is for your personal use only. Sharing it with others, including websites, helping or seeking help from others for your project work will be deemed as copyright violation and plagiarism. Such actions will result in an automatic forfeit of your course grade to F in addition to any University disciplinary proceedings. You may leverage the course materials, solutions, etc., given to you, as well as parts of your own assignment solutions for your project implementation. If you use concepts and snippets of code from other sources such as websites, they will have to be documented in your code as a proper comment. Lack of such citation will also be treated as plagiarism. In any case, utilizing such external resources must be limited to bare syntactical references (e.g - how to include a backslash - \ symbol in sed pattern) and should not result in you copying the major part of your program logic from such resources (e.g. - how do I traverse a linked list). Both software and manual mechanisms will be employed for plagiarism detection. You MUST use mimi.cs.mcgill.ca to create the solution to this project. You must not use your Mac command-line, Windows command-line, nor a Linux distro installed locally on your laptop. You can access mimi.cs.mcgill.ca from your personal computer using ssh or putty and also transfer files to your computer using filezilla or scp as seen in class and in Lab A and mini assignment 1. Instructors/TAs upon their discretion may ask you to demonstrate/explain your solution. No points are awarded for commands that do not compile/execute at all. (Commands that execute, but provide incorrect behavior/output will be given partial marks.) All questions are graded proportionally. This means that if 40% of the question is correct, you will receive 40% of the grade. Please read through the entire project description before you start working on it. You can loose several points for not following the instructions. Points can be deducted for violating the constraints set forth in the questions, including for the steps where an explicit deduction is not specified. It will also help you get the bigger picture of the project. There are also some helpful hints given at the end of this document that can be useful to you. Go through the checklist at the end to ensure that you have turned in all the required files. Files that are not turned-in will not be given a second chance. The total points allocated to this project is 25. Project Synopsis For your final project, you will implement a software solution that consists of shell scripts and C program to compute the lab attendance associated with each student. 1 Exercise 1 - Version Control (2 Points) Create a local git repository (private) in your home directory. You will be using this for the rest of your final project work to write any shell scripts, C programs, etc. DO NOT use public repositories such as github. We expect to see at the least 4 commits, each of which are at the least 10 minutes (or more) apart. So commit your work frequently as you reach some logical milestone of your project work. No points will be allocated for this exercise unless this requirement is completely met. You must turn in your git log command output copied/redirected as git.txt file, once you have finished your complete project work. Exercise 2 - A Shell Script to Pre-process the Information in the CSV Files. (6 Points) At the end of a lab session, TAs will download a CSV file that contains the attendance information recorded by zoom into their respective folders. Let us start by taking a peak at the directory. The output below is truncated for brevity. $ tree LabAttendance LabAttendance |-- lab1 | |-- lab-A.csv | |-- lab-B.csv ........ | |-- lab-I.csv ... |-- lab3 | |-- Lab-A.csv ... |-- lab4 | |-- LAB-A.csv ...... | |-- LAB-I.csv | |-- lab5 ...... |-- lab6 ... |-- lab7 |-- lab-a.csv ... |-- lab-i.csv As we can see, each of the seven lab groups (1 through 7) has an attendance file for each of the nine labs (A through I). While the CSV filename conventions are consistent, their case (uppercase/lowercase) can be in different combinations depending on how the TA named their files. Next, let us take a peek into some of these CSV files. (These are synthetic data, not actual student names). $ head -3 lab1/lab-A.csv Name (Original Name),User Email,Total Duration (Minutes),Guest Sharda Freedman,[email protected],64,No Sterling Boone,[email protected],64,No $ head -3 lab5/Lab-A.csv Name (Original Name),User Email,Join Time,Leave Time,Duration (Minutes),Guest Mack Boyd,[email protected],01/21/2021 08:58:30 PM,01/21/2021 10:17:06 PM,79,No Chung Tibbs,[email protected],01/21/2021 08:58:31 PM,01/21/2021 10:03:25 PM,65,No 2 The CSV files have can have one of two possible formats (each file follows one or the other and not a mix). The second format contains the join time and leave time as extra attributes compared to the first format. Your first task is to collect the information from all these CSV files and build a consolidated CSV file that contains the records in a common format. 1. Create a shell script fixformat.sh to do this task. You can use any shell/Unix commands already available in mimi to implement this script (other than sorting). 2. The shell script expects two arguments, the first being the directory under which it should recursively search for the CSV files that follows the naming convention mentioned above. You should find such CSV files no matter under which subdirectory they are stored in (i.e., subdirectory names and depths should not influence the outcome). In other words, even if we add a new lab group, etc., it should not impact your script. Your shell script’s objective must be to look for the CSV files that follow the naming convention anywhere under that directory hierarchy. The second argument is the CSV file into which the script will store the re-formatted (and consolidated) output that it processed from all the input CSV files. Either of these arguments could be absolute or relative paths. 3. (1 Point) If the shell script is not invoked with sufficient arguments, display a usage message and terminate with code 1. $ ./fixformat.sh Usage fixformat.sh $ echo $? 1 4. (1 Point) If the first argument is not a name of an existing directory, the script should throw an error message and terminate with code 1. $ ./fixformat.sh /data/LabAttendance /data/labdata.csv Error /data/LabAttendance is not a valid directory 5. Do not create an output file in the error/usage situations described above. (-1 Points). 6. (4 Points) When invoked correctly, the script will find all the CSV files under the given directory hierarchy that follows the naming convention (mentioned previously), reformat the information and consolidate them into a single output CSV file, after which it will terminate with code 0. $ ./fixformat.sh /data/LabAttendance /data/labdata.csv $ echo $? 0 A sample of the output is given below. $ head -3 /data/labdata.csv User Email,Name (Original Name),Lab,Total Duration (Minutes) [email protected],Usha Rush,D,64 [email protected],Bessie Thompson,D,58 There is a header at the top of the file, followed by the actual information records. The shell script has done the following transformations. (a) For each record, it included only the email, name and duration information from the original CSV files. (b) To each record, it added a new column, Lab, which it derived from the name of each CSV file and added to the records that it read from that CSV file (the values of this column represents the labs A through I). The values for this column should be uppercase alphabets irrespective of the case of the CSV filenames. The output produced by your shell script should follow the same exact formatting (order of columns, etc.). There is no particular order in which the actual attendance information records are to be stored in the CSV file. Deliberately sorting attendance records when producing the output is not allowed and can result in a 0 for this exercise. That will be the task of the C program in the next exercise. 3 7. Existing output files must be overwritten by your script (not appended). 8. You need not handle any other error/failure situations other than those mentioned above. 9. You do not have to handle conditions where a directory may not have any relevant CSV files or the CSV files not having headers/records (i.e, any file that matches the naming convention will be valid CSV files). Exercise 3 - A C Program to Compute the Attendance. (10 Points) Now that we have done some preliminary cleaning of the attendance data, it is time to compute the attendance associated with each student. At a high level, first we need to figure out for each student how much time (duration) they attended a lab. Keep in mind that even for a given lab, (say lab D) a student may have multiple records. This is because the student might have got disconnected and had to connect back (which results in multiple zoom records for the same meeting). Another reason could be that the student could only attend part of the lab for their group (say lab 2) and had to catchup on another TA’s lab (say lab 5). In all of these cases, our objective is to find the net amount of time (duration) that the student spent on a given lab (say lab D). 1. Use vim to create C program files labapp.c, zoomrecs.c, zoomrecs.h and a makefile. You are not allowed to create any
Answered 6 days AfterApr 19, 2021

Answer To: School of Computer Science, McGill University COMP-206 Introduction to Software Systems, Winter 2021...

Kamal answered on Apr 25 2021
132 Votes
labapp.c
#include "zoomrecs.h"
int main(int argc, char** argv)
{
    FILE* file;
    char buf[1024];
int row = 0;
int col = 0;
// open command-line's first argument with read mode
    file = fope
n(argv[1], "r");

// if not exist
if (!file)
printf("Can't open file\n");

else
{
// read each line
while (fgets(buf, 1024, file))
{
col = 0;
row++;
// skip unnecessary record
if (row == 1)
continue;
// splitting the records
char* record = strtok(buf, ",");
while (record)
{
/*
* call to store each record into linked list
* split again and again
*/
addZoomRecord(record, col);
record = strtok(NULL, ",");
col++;
}
}
}
/*
* open command-line's second argument with read mode
* print the first row into csv file
* call to print records into csv file
* close the second one
*/
file = fopen(argv[2], "w");
fprintf(file, "User Email,Name (Original Name),A,B,C,D,E,F,G,H,I,Attendance (Percentage)\n");
generateAttendance(file);
fclose(file);
    return 0;
}
Makefile
output: labapp.o zoomrecs.o
    gcc labapp.o zoomrecs.o -o labapp
labapp.o: labapp.c zoomrecs.c zoomrecs.h
    gcc -c labapp.c zoomrecs.c
clean:
    rm labapp.o labapp zoomrecs.o
zoomrecs.c
#include "zoomrecs.h"
/* read from the input file */
void addZoomRecord(char* record, int col)
{
// column contains email
if (col == 0)
{
// flag disable
int f = 0;
for (current = root; current != NULL; current = current->next)
{
// email already exist
if (strcmp(current->email, record) == 0)
{
// flag enable
f = 1;
break;
}
}
// for a new email
if...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here