Question: Create a class Professor The class must have constructor to initialize the following attributes profID - Professor ID - Integer valueprofName - Professor Name -
Create a class Professor
The class must have constructor to initialize the following attributes
profID Professor ID Integer valueprofName Professor Name StringsubDict Subject Dictionary Dictionary with Subject Name as keys and the number of years the professor has experience in that subject
Create a class University
The class must implement two functions namely
getTotalExperienceselectSeniorProfessorBySubject
Function Explanations
getTotalExperience
Input:
proflist List of Professor Class Objects
profid Professor ID
Output:
total Integer Total experience of the professor
STEPS
The function must loop through the proflist and must find the total experience of the professor object whose ID is equal to theparameter professor ID as reference
Hint: Total experience is the sum of all the years of experience that the professor has invarious subjects
Hint: Write the logic to sum all the values of Dictionary subDict to find the total experience of the specific Professor.
selectSeniorProfessorBySubject
Input:
proflist List of Professor Class Objects
subnameString Subject Name
Output:
result Object of Professor Class
STEPS
The function must find the Professor object who is seniorin the subject subname passed in parameteramong all the professors in the University
Hint: Function must loop through proflist. In each iteration ie for each Professor Objectit must find the yearsof experience the professor has in that particular Subject by checking it in the dictionary subDict
Hint: After comparing each, the Professor class object who has the maximum years of experience must be returned from function by storing it inresult variable.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
