Question: Advanced Zoo Management System Objective: To develop a Python application utilizing inheritance, polymorphism, exception handling, and lists to manage various animals in a zoo effectively.
Advanced Zoo Management System
Objective:
To develop a Python application utilizing inheritance, polymorphism, exception handling, and lists to
manage various animals in a zoo effectively.
Instructions:
This assignment is to be completed individually.
Your code should be wellcommented to explain the logic and functionality.
Submit all files in a single ZIP folder titled 'AdvancedZooManagementYourNameStudentID'.
Requirements:
Part A: Class Design and Inheritance Points
Design a base class named 'Animal' and derive the following subclasses: 'Mammal', 'Bird', 'Reptile'.
Attributes:
'name' str: the animal's name.
'age' int: the animal's age in years.
'healthstatus' str: the animal's health condition, acceptable values are 'Good', 'Fair', or 'Poor'.
Methods:
An method that initializes the attributes.
A 'displayinfo method to print details of the animal.
Specific behaviors:
'Mammal': 'givebirth Outputs a message indicating the mammal has given birth.
'Bird': 'layeggs Outputs a message that the bird has laid eggs.
'Reptile': 'sunbathe Outputs a message about the reptile sunbathing.
Part B: Polymorphism Points
Implement a method 'makesound that exhibits polymorphism:
'Mammal': Outputs "Various sounds depending on the species, eg Bark or Roar".
'Bird': Outputs "Chirps".
'Reptile': Outputs "Hisses".
Part C: Exception Handling Points
Implement basic exception handling for animal instantiation:
Handle exceptions such as invalid 'age' types and 'healthstatus' values not in the predefined list.
Use custom exceptions like 'InvalidAnimalError' for trying to add an undefined animal type.
Part D: Using Lists Points
Implement list functionalities to manage the zoo's animals:
Maintain a list of animals in the zoo.
Implement methods to add and remove animals from this list.
Use list methods such as 'append 'remove and 'pop appropriately.
Part E: Implementing and Demonstrating Functionality Points
Create a demonstration script that:
Instantiates each type of animal.
Demonstrates adding and removing animals from the zoo list.
Showcases exception handling by deliberately causing errors.
File Organization:
animals.py: This file will contain the definition of the base class Animal and all its subclasses Mammal,
Bird, and Reptile.
zoo.py: This file will contain the definition of the Zoo class which manages a collection of animals.
exceptions.py: This file will define custom exceptions that are used throughout the zoo management
system.
main.py: This file will be the entry point of the application, where instances of animals are created, added
to the zoo, and manipulated.
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
