In a university, there are 20 teachers. We want to develop a Python program that manages the payment of teachers' salaries.
A full professor can have one of the following ranks: assistant, master-assistant, lecturer and professor -> 'A', 'M_A', 'M_C', 'Pr' respectively.
A temporary teacher can have one of the following grades: engineer, doctor and expert -> 'Ing', 'Dr', 'Exp' respectively.
To calculate the salary:
If the teacher is a temporary teacher: he/she is paid per hour. The salary of a part-time teacher is calculated as follows:
Formula_vacataire = (number_hour* basic_price_hour)-20
The hourly rate of the engineer is the basic hourly rate. Doctor's hour price is more than 30% of the base hour, and expert's hour price is more than 50% of the base hour.
If the teacher is a tenured professor: the assistant is paid the basic salary, the master-assistant is paid 20% more than the assistant. Lecturer 30% more than the assistant and professor 50% more than the assistant.
The initial salary of the assistant is given by the user, the same for the price of the basic hour for the lecturer.
In this program you have to perform the following functions:
Add the function Teacher ( ) which returns a list of tuples of 20 teachers. A teacher is characterized by :
Number (int),
Last name (str),
First name (str),
Date of Birth (e.g. 1995-01-01 :str),
Year of hiring (e.g. 2020 : str),
Title ('V' for temporary and 'T' for permanent : str).
Grade (str).
(matricule, Name, First name, Date_Birth, Date_Hiring, Title, Grade)
Add the function Age which takes in parameter the list of the teachers which returns a list of the ages of the teachers. To get today's date use the datetime library, and extract only the years (age=2021-1993)
import datetime
today = datetime.date.today()
year = today.year
Add the function salaire_vacataire which takes as parameter the list of teachers and a matricule and returns the salary of a temporary worker (float). The price of an hour and the number of hours are given by the user.
Add the function salary_titular which takes as parameter the list of teachers and returns the salary of a titular (float) whose matricule is given by the user. The basic salary is given by the user.
Add the function Seniority which takes in parameter the list of teachers and which returns a dictionary (key: personnel number, value: years of seniority of the employee) of the tutored teachers.
Add the function IncreaseSalary which takes as parameters the list of teachers and the dictionary of seniority and which increases the salary of the tutored teachers by taking into account the seniority:
If Seniority < 5 years, then add 2%.
If seniority < 10 years, then 5% is added.
Otherwise, 10% is added.
This function returns a dictionary of (key: personnel number, value: new salary).
Add a TeachersComp function which takes as parameters the list of teachers, the seniority dictionary, the age list and the salary increase dictionary and returns a list of tuples containing the complete information of the teachers. Each tuple will contain the following information:
(Personnel number, Last name First name, Age, Seniority, Title, Grade, Salary)
Last name and first name in the same element: NAME in capital letters and First name only the first letter in capital letters separated by a space. The increased salary for full time employees. For the temporary employees put "N/A" in the seniority.
Write the main program that allows, using the above functions, to:
Enter the teachers' information and display the list (with a simple print)
Calculate the ages of the teachers and display the list (with a simple print)
Calculate the seniority of the teachers and display the dictionary (with a simple print)
Calculate the salary increases of the teachers and display the dictionary (with a simple print)
Display the complete information of the teachers (with a simple print)
You have to start by declaring the list of teachers e, the list of ages l_age, the dictionary of seniority d_anc, the dictionary of salary increases d_aug, and the list of complete information of the teachers ens_comp.
Translated with www.DeepL.com/Translator (free version)
What I have tried:
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing
nothing