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 03:00
Which action describes an aspect of technological design?
Answers: 1
question
Computers and Technology, 22.06.2019 05:00
Write a loop that reads positive integers from standard input and that terminates when it reads an integer that is not positive. after the loop terminates, it prints out, on a line by itself and separated by spaces, the sum of all the even integers read, the sum of all the odd integers read, a count of the number of even integers read, and a count of the number of odd integers read, all separated by at least one space. declare any variables that are needed. assume the availability of a variable, stdin, that references a scanner object associated with standard input. that is, stdin = new scanner(system.in); is given.
Answers: 3
question
Computers and Technology, 22.06.2019 16:00
Why should characters such as / \ " ' * ; - ? [ ] ( ) ~ ! $ { } < > # @ & | space, tab, and newline be avoided in file names?
Answers: 2
question
Computers and Technology, 22.06.2019 20:10
Assume that minutes is an int variable whose value is 0 or positive. write an expression whose value is "undercooked" or "soft-boiled" or "medium-boiled" or "hard-boiled" or "overcooked" based on the value of minutes. in particular: if the value of minutes is less than 2 the expression's value is "undercooked"; 2-4 would be a "soft-boiled", 5-7 would be "medium-boiled", 8-11 would be "hard-boiled" and 12 or more would be a "overcooked".
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
History, 17.04.2021 23:40
question
World Languages, 17.04.2021 23:50
question
Computers and Technology, 17.04.2021 23:50
question
Spanish, 17.04.2021 23:50
Questions on the website: 13722363