Write a factory (HenFactory) for making chickens (Hen):
1. Write a Hen class.
1.1. Make it abstract.
1.2. Add an int getMonthlyEggCount() method to the abstract class.
1.3. Add a String getDescription() method to the class. It should return "I am a chicken."
2. Create an NorthAmericanHen class that inherits Hen.
3. Create an EuropeanHen class that inherits Hen.
4. Create an AsianHen class that inherits Hen.
5. Create an AfricanHen class that inherits Hen.
6. In each of these four classes, write your own implementation of the getMonthlyEggCount method.
The method should return the number of eggs per month produced by that type of chicken.
7. In each of these four classes, write your own implementation of the getDescription method.
The method must return a string as follows:
<parent class>.getDescription() + " I come from <continent>. I lay <n> eggs a month."
where <continent> is the name of the continent
and <n> is the number of eggs per month.
8. In the HenFactory class, implement the getHen method. It should return a chicken breed corresponding to the continent that the chicken came from.
9. All the classes you create must be in separate files.
- The Hen class must be abstract.
- The Hen class must have an abstract int getMonthlyEggCount() method.
- The Hen class must implement a String getDescription() method, which returns "I am a chicken."
- The NorthAmericanHen, EuropeanHen, AsianHen, and AfricanHen classes must inherit the Hen class and be located in separate files.
- The NorthAmericanHen, EuropeanHen, AsianHen, and AfricanHen classes must implement the getMonthlyEggCount method, which should return the number of eggs per month laid by the corresponding type of chicken.
- The NorthAmericanHen, EuropeanHen, AsianHen, and AfricanHen must override the parent class's getDescription method so that the returned string looks like this: <parent class>.getDescription() + " I come from <continent>. I lay <n> eggs a month." where <continent> is the name of the continent, and <n> is the number of eggs per month.
- The getHen method must be implemented in the HenFactory class and must return the chicken type that corresponds to the passed continent.