PROGRAMMING:List stores animal objects
This question requires that animals, including birds and dogs, be stored in the list. Please write the code to complete the following contents: < br / >
1. Define the abstract class animal, including private properties name and age, and complete setter, getter, construction method with parameters for it, as well as eclipse generating toString method < br / >
2. Define the subclass bird, inherit animal, complete the construction method with parameters, and rewrite the toString method< br/>
3. Define subclass dog, inherit animal, add attribute leg, complete setter and getter for it, complete construction method with parameters, and rewrite toString method < br / >
4. In the main method of the main class, define the list, and specify that only dog and bird can be put in the list. Complete the following operations: < br / >
1. Enter the integer n to represent the number of objects added to the list, and then add n animals to the list
2. Before adding each object, if you enter the integer 1, it means adding the dog object, enter other integers, add the bird object, and then enter the relevant attributes through the keyboard to create the corresponding object and add it to the list.
3. Output all list objects at one time
4. Enter a name on the keyboard, and then judge whether there is an object property in the list. If the name is the same, output the class name of the object and the information of the object,
If there is no object, the name is the same as the keyboard input, and "no this one" is displayed“
###Input format:
Please write the input format here. For example: input 2 integers a and B with absolute value no more than 1000 in one line.
###Output format:
Please describe the output format here. For example, for each group of inputs, output the value of a + B in one line.
###Input example:
Here is a set of inputs. For example:
```in
four
one
tom 3 3
two
bir 2
one
may 3 5
two
baby 3
may
```
```in
three
one
tom 3 2
two
may 4
one
jerry 3 1
tina
```
###Output example:
The corresponding output is given here. For example:
```out
[Dog[leg=3, name=tom, age=3], Bird[name=bir, age=2], Dog[leg=5, name=may, age=3], Bird[name=baby, age=3]]
Dog
Dog[leg=5, name=may, age=3]
```
```out
[Dog[leg=2, name=tom, age=3], Bird[name=may, age=4], Dog[leg=1, name=jerry, age=3]]
no this one
```
answer:If there is no answer, please comment
1. Define the abstract class animal, including private properties name and age, and complete setter, getter, construction method with parameters for it, as well as eclipse generating toString method < br / >
2. Define the subclass bird, inherit animal, complete the construction method with parameters, and rewrite the toString method< br/>
3. Define subclass dog, inherit animal, add attribute leg, complete setter and getter for it, complete construction method with parameters, and rewrite toString method < br / >
4. In the main method of the main class, define the list, and specify that only dog and bird can be put in the list. Complete the following operations: < br / >
1. Enter the integer n to represent the number of objects added to the list, and then add n animals to the list
2. Before adding each object, if you enter the integer 1, it means adding the dog object, enter other integers, add the bird object, and then enter the relevant attributes through the keyboard to create the corresponding object and add it to the list.
3. Output all list objects at one time
4. Enter a name on the keyboard, and then judge whether there is an object property in the list. If the name is the same, output the class name of the object and the information of the object,
If there is no object, the name is the same as the keyboard input, and "no this one" is displayed“
###Input format:
Please write the input format here. For example: input 2 integers a and B with absolute value no more than 1000 in one line.
###Output format:
Please describe the output format here. For example, for each group of inputs, output the value of a + B in one line.
###Input example:
Here is a set of inputs. For example:
```in
four
one
tom 3 3
two
bir 2
one
may 3 5
two
baby 3
may
```
```in
three
one
tom 3 2
two
may 4
one
jerry 3 1
tina
```
###Output example:
The corresponding output is given here. For example:
```out
[Dog[leg=3, name=tom, age=3], Bird[name=bir, age=2], Dog[leg=5, name=may, age=3], Bird[name=baby, age=3]]
Dog
Dog[leg=5, name=may, age=3]
```
```out
[Dog[leg=2, name=tom, age=3], Bird[name=may, age=4], Dog[leg=1, name=jerry, age=3]]
no this one
```
answer:If there is no answer, please comment