subject

Description: You are to create two subclasses of the Animal class (from the previous Animal Class Challenge) that is used to store information about either a mammal or a bird. You are then to extend the Animal Generator program that takes user input, allowing the user to create multiple Mammal or Bird objects. Finally, you are to retrieve the information stored in those objects and display it. Purpose: The purpose of this challenge is to provide experience creating and using subclasses in Python 3.
Requirements:
You are to create two subclasses of the Animal class (from the previous Animal Class Challenge) that is used to store information about either a mammal or a bird. You are then to extend the Animal Generator program that takes user input, allowing the user to create multiple Mammal or Bird objects. Finally, you are to retrieve the information stored in those objects and display it.
The solution from the previous Animal Class Challenge is available as part of the Animal Class Retrospective.
Mammal Class
Write a class named Mammal that inherits from the Animal class that has the following additional attribute and method. This class is to be added to the Animal. py file that was created for the Animal Class Challenge.
Attributes
The following hidden attribute is used to indicate the color of the mammal’s hair.
__hair_color:
Methods
The following method is to initialize the two attributes from the Animal class required in the Animal class’ __init__, the single attribute listed above, and assign their default values.
__init__:
The following method is to return the value of the __hair_color field.
get_hair_color:
Bird Class
Write a class named Bird that inherits from the Animal class that has the following additional attribute and method. This class is to be added to the Animal. py file that was created for the Animal Class Challenge.
Attributes
The following hidden attribute is used to indicate if the bird can fly.
__can_fly:
Methods
The following method is to initialize the two attributes from the Animal class required in the Animal class’ __init__, the single attribute listed above, and assign their default values.
__init__:
The following method is to return the value of the __can_fly field.
get_can_fly:
Animal Generator Program
Once you have written the classes, extend the animalGenerator. py from the Animal Class Challenge. This program is to use Animal. py as a module.
In animalGenerator. py, prompt the user to enter if they would like to create a mammal or a bird.
If the user selects mammal, prompt the user for the name, type of the mammal, and the color of hair. Create a new Mammal object to store this data.
If the user selects bird, prompt the user for the name, type of the bird, and if the bird can fly. Create a new Bird object to store this data.
Finally, ask the user if they would like to repeat the process. They are to be able to create as many Mammal and Bird objects as they like.
After the user is done creating animals, this program is to use the object’s accessor methods to retrieve the name, type, and mood of each animal. This information is to be formatted and displayed as shown in the sample program output below.
Sample Output
Welcome to the animal generator!
This program creates Animal objects
Would you like to create a mammal or bird?
1. Mammal
2. Bird
Which would you like to create? 2
What type of bird would you like to create? Penguin
What is the bird’s name? Peggi
Can the bird fly? Yes
Would you like to add more animals (y/n)? y
Would you like to create a mammal or bird?
1. Mammal
2. Bird
Which would you like to create? 1
What type of mammal would you like to create? Tiger
What is the mammal’s name? Truman
What color is the mammal’s hair? Orange
Would you like to add more animals (y/n)? n
Animal List
Peggi the Penguin is sleepy
Truman the Tiger is hungry
Testing
Run the program you write and verify that the information entered matches the information displayed and that the input prompts and output utilize the format specification provided.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:30
Jane’s team is using the v-shaped model for their project. during the high-level design phase of the project, testers perform integration testing. what is the purpose of an integration test plan in the v-model of development? a. checks if the team has gathered all the requirements b. checks how the product interacts with external systems c. checks the flow of data in internal modules d. checks how the product works from the client side
Answers: 1
question
Computers and Technology, 22.06.2019 19:20
1)consider the following code snippet: #ifndef book_h#define book_hconst double max_cost = 1000.0; class book{public: book(); book(double new_cost); void set_cost(double new_cost); double get_cost() const; private: double cost; }; double calculate_terms(book bk); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_cost should be removed since header files should not contain constants.c)the definition of book should be removed since header files should not contain class definitions.d)the body of the calculate_terms function should be added to the header file.
Answers: 1
question
Computers and Technology, 24.06.2019 00:50
Which of the following is not a key player in the sale of travel products?
Answers: 2
question
Computers and Technology, 24.06.2019 11:00
Why is it uncommon for users to perform searches directly in database tables? a.)users are discouraged from interacting directly with tables because they might confuse tables with spreadsheets. b.) users are discouraged from interacting directly with tables because this may result in unintended changes to source data. c.)users do not have the technical skills required to perform searches directly in database tables. d.)users do not have the permissions required to perform searches directly in database tables.
Answers: 1
You know the right answer?
Description: You are to create two subclasses of the Animal class (from the previous Animal Class Ch...
Questions
question
Biology, 06.11.2020 23:10
question
Arts, 06.11.2020 23:10
question
Mathematics, 06.11.2020 23:10
question
English, 06.11.2020 23:10
question
English, 06.11.2020 23:10