Question: 1 . Write Input Files: First, create input files for each department. Each file should be named using the format DEPARTMENT _ CODE.txt ,

1. Write Input Files:
First, create input files for each department. Each file should be named using the format
"DEPARTMENT_CODE.txt," where "DEPARTMENT" is the department name and
"CODE" is a unique identifier. Each file will contain revenue contributions from Quarter 1
out of 25, Quarter 2 out of 25, Quarter 3 out of 25, and Quarter 4 out of 25, along with an
employee ID. Each line represents the revenue contributions for a specific employee within
that department.
2. Read Input Files and Process Data:
Using the provided code, read the input files. For each department, calculate:
The average revenue for each quarter.
The number of employees who did not meet the annual revenue target of $80,000.
3. Write Output Files:
Based on the processed data, generate the following output files for each department:
Average Revenue File (DEPARTMENT_CODE_avg.txt): Contains the average revenue
for each quarter.
Failed Employees File (DEPARTMENT_CODE_failed.txt): Lists the employee IDs of
those who did not meet the annual revenue target.
Notes:
Replace "DEPARTMENT" with the actual department name and "CODE" with the
unique identifier for each department.
You can create more than two departments. The number of output files will
correspond to the number of departments you include.
In Google Colab, the default working directory is /content (unless you have not
changed it previously). If you use os.getcwd() then it will also return you the current
working director and by default it is /content.
In your assignment, when you will need to read the files to calculate the average and
the number of employees not meeting the target then you need to provide the path so
that program will first go on that path and will read your just written files to pick the
values from there to perform the calculations. So for that purpose you need to provide
the path and as mentioned, by default it is /content so you will provide that.
Programming Fundamentals- ICT701
Kings Own Institute
Dr Rabia Bashir
TASK2:
You need to upload the file financial_report.txt in your current working directory before
performing any operation. I have explained in detail about file uploading in file handling
helping material file.

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 Programming Questions!