Home / Expert Answers / Computer Science / this-is-in-python-language-i-39-m-just-wondering-how-the-constructor-will-check-for-these-values-sho-pa129

(Solved): this is in python language. I'm just wondering how the constructor will check for these values?, sho ...



You need to write a Department class that maintains the information about the university departments. You need to write yourthis is in python language. I'm just wondering how the constructor will check for these values?, should the dictionary be written as an argument in the constructor and how ill the dictionary be like ?, if I do so will it still be a static variable as required?, How can this be achieved? a file is given with the values

You need to write a Department class that maintains the information about the university departments. You need to write your code in the given Department class. It must contain the following: 1. There will be two static class variables (int) and (dictionary). will be used to maintain an incremental department identifier (initialized to 0). dpDict will be used to maintain an association between department identifiers (keys) and department names (values) as a dictionary. 2. The getNextDepID method (a static method) will compute and return the incremental department id. 3. The class constructor will receive the department name and the appointment date and use them to create an instance of the class. It will also add a department identifier to the instance. You will hide all three instance variables (make them private by adding the double underscore preceding the variable names). The constructor will check if the department name exists as a value in the dictionary Dict. If it does, use the respective key (existing id) as the department id. Otherwise, use the getNextDepID method to generate a new incremental department id; also add this department name-id pair to the dictionary Dict. 4. There will be three accessor methods: get_dep_id, get_dep_name, and get_join_date. These methods will return the department id, department name, and joining date respectively. 5. The __str_ method will print the Department information as shown in the screenshots.


We have an Answer from Expert

View Expert Answer

Expert Answer


Here is an example implementation of the Department class in Python that meets the requirements you described:class Department: dpID = 0 dpDict
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe