Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this 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
this 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 dpID (int) and dpDict (dictionary). dpID 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 dp 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 dp 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 screenshotsStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started