Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In this programming assignment, you are going to create a class named Animal that is used to store information about an animal. You will then
In this programming assignment, you are going to create a class named Animal that is used to store information about an animal. You will then create a program that takes user input, allowing the user to create multiple Animal objects. Finally, you will retrieve the information stored in those objects and display it.
Please Use Python 3 and include copy of the code. Thanks!
In this programming assignment, you are going to create a class named Animal that is used to store information about an animal. You will then create a program that takes user input, allowing the user to create multiple Animal objects. Finally, you will retrieve the information stored in those objects and display it. Animal Class attributes and methods. Save this Write a class named Animal that has the following clas s as Animal.py Attributes _ a n i mal-t y pe: a hidden attribute used to indicate the animal's type. For example: gecko, walrus, tiger, etc. _name: a hidden attribute used to indicate the animal's name. _mood: a hidden attribute used to indicate the animal's mood. For example: happy, hungry, or sleepy Methods init__:this method should create the three attributes above and assign their default values. The value ofmood should be set randomly. Generate a random number between 1 and 3. Then: If the number is 1, the-mood field should be set to a value of happy" If the number is 2, the_mood field should be set to a value of "hungry" If the number is 3, the-mood field should be set to a value of sleepy" get animal_type: this method should return the value of the animal_type field. get_name: this method should return the value of the__name field. check_mood: this method should return the value of the__mood fieldStep 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