2023 Fall PF Assignment 3 v2.0
2023 Fall PF Assignment 3 v2.0
● You must never share your assignment with anyone. If any part of your assignment is found to be
copied, then you will be awarded 0 marks as per the university policy.
● The assignment must be submitted before the deadline.
● Carefully read the submission instructions given below.
Submission:
For instance, for a 2 x 2 input matrix resultant matrix would have dimensions 1 x 1, for a 4 x 4
input matrix resultant matrix would have dimensions 2 x 2, and for 8 x 8 input matrix resultant
matrix have dimensions 4 x 4. Please refer to the following image to review the working of the
program.
The following matrix has four submatrices of 2 x 2 dimensions, and their maximum values are
saved into a new matrix having dimensions 2 x 2. For example, each submatrix's subscripts and
max values are provided in the example below.
max(A[0][0],A[0][1],A[1][0],A[1][1]) = 5, max(A[0][2], A[0][3], A[1][2], A[1][3]) = 3
max(A[2][0], A[2][1], A[3][0], A[3][1]) = 7, max(A[2][2], A[2][3], A[3][2], A[3][3]) = 4
A) Your solution must have the required functions for matrix processing. For 2x2, for 4x4 and for 8x8,
equal points are allocated. [15 points]
B) Main function that operates and performs operation on the functions. Use your student id as input
to the functions. E.g., 23k-1234 then your input array should have your id of 1234 repeatedly. [5
points]
Make sure that your student ID and Name is visible in every output. Plagiarism will result in a direct 0
grade in the assignment.
A) For each of the 4 departments, initialize the attributes of their employees randomly using
the rand () function.
a. Create an initial pool of 20 names from which the names will be randomly assigned
to each employee. A name cannot be repeated twice. If your names are same as
any other student, then you will be awarded 0 marks.
b. Each department will have exactly the following roles: Director, Executive,
Manager, Employee, Trainee. A role cannot be repeated twice in the same
department. The values for communication, teamwork, and creativity should be
between 1 and 100 (inclusive), also randomly assigned.
B) The retail company wants to give an award for “Best Department”. To find this out, you
must compute the sum of values of each employee for all the departments. Then compare
these 4 sums with each other to find out the best department. Your program should
output the sum for each department along with the winner of the award of “Best
Department”. You must print the Best Department details in the tabular form with all
employees and their attributes.
Question 3: [10 points]
Create three text files named Department.txt, Personal.txt and Combine.txt. The Personal.txt file contains
ID and Name. Whereas the Department.txt file contains ID and Salary. Write a function that takes input
as record IDs and merges the details from both personal and department files and then add this entry into
the Combine.txt file (ID, Name, Salary).
Personal.txt Department.txt
ID Name ID Salary
Combine.txt
ID Name Salary
Worker:
Bonus: Title:
a. Display the details of the workers having a maximum salary for each department.
Sample Output:
003 Vishal Singhal 300000 2014-02-20 HR
004 Amitabh Singh 500000 2014-02-20 Admin
006 Vipul Diwan 200000 2014-06-11 Account
b. Fetch departments along with the total salaries paid for each of them. e.g.
Sample Output:
HR - 400000
Admin - 1170000
Account - 275000