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 01:50
A.) generate scaffolding to create database for your application. develop all the entities identified in assignment #2. add any additional that may be identified later. b.) add data validation rules to the models that are appropriate for your application and data. c.) create links for each scaffold in the header section. part 2: application updates [30 points] a.) add two additional views to the "home" controller you created in assignment #1. b.) the two views should be named as “privacy" and "". c.) link the two newly created views in the footer section. hint: you would need to modify the “home" controller definition and create “privacy.html.erb" and “.html.erb" files in appropriate locations.
Answers: 3
question
Computers and Technology, 22.06.2019 03:10
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it must not appear in the factorization. sample runs are given below. note that if the power of a prime is 1, then that 1 must appear in t
Answers: 3
question
Computers and Technology, 22.06.2019 20:10
Assume the existence of a bankaccount class. define a derived class, savingsaccount that contains two instance variables: the first a double, named interestrate, and the second an integer named interesttype. the value of the interesttype variable can be 1 for simple interest and 2 for compound interest. there is also a constructor that accepts two parameters: a double that is used to initialize the interestrate variable, and a string that you may assume will contain either "simple", or "compound", and which should be used to initialize the interesttype variable appropriately. there should also be a pair of functions getinterestrate and getinteresttype that return the values of the corresponding data members (as double and int respectively).
Answers: 2
question
Computers and Technology, 23.06.2019 08:30
All of these are true about using adhesive except: a. dissimilar materials can be joined. b. mixing tips are product and material specific. c. a specific application gun may be required. d. two-part adhesives are dispensed using two mixing tips
Answers: 3
You know the right answer?
Description: You are to create two subclasses of the Animal class (from the previous Animal Class Ch...
Questions
question
Mathematics, 05.05.2020 09:35
question
English, 05.05.2020 09:35
Questions on the website: 13722363