Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to write a program in Python 3.4 called Animal class. In this programming

ID: 3773385 • Letter: I

Question

I need to write a program in Python 3.4 called Animal class.

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.

Write a class named Animal that has the following attributes and methods. Save this class as Animal.py

Attributes

__animal_type: 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 of __mood 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 field

Once you have written the Animal class, create another program called animalGenerator.py. This program should use Animal.py as a module.

In animalGenerator.py, prompt the user to enter the name and type of an animal. Create a new Animal object to store this data. Then ask the user if they would like to repeat the process. They should be able to create as many Animal objects as they would like.

After the user is done creating animals, this program should use the object’s accessor methods to retrieve the name, type, and mood of each animal. This information should be formatted and displayed as shown in the sample program output below

Sample Program Operation

User input is highlighted in orange

Welcome to the animal generator! This program creates Animal objects

What type of animal would you like to create? Gecko What is the animal's name? Gordon

Would you like to add more animals (y/n)? y

What type of animal would you like to create? Walrus What is the animal's name? Wally

Would you like to add more animals (y/n)? y

What type of animal would you like to create? Tiger

What is the animal's name? Truman

Would you like to add more animals (y/n)? n

Animal List ----------- Gordon the Gecko is hungry Wally the Walrus is sleepy Truman the Tiger is hungry

Explanation / Answer

Animal.py:

Zoo.py: