return super.getDescription()+"我来自"+Continent.NORTHAMERICA+"。我每个月下 "+getMonthlyEggCount()+" 个鸡蛋。";
package zh.codegym.task.task14.task1408;
/*
鸡肉工厂
*/
public class Solution {
public static void main(String[] args) {
Hen hen = HenFactory.getHen(Continent.AFRICA);
hen.getMonthlyEggCount();
}
static class HenFactory {
static Hen getHen(String continent) {
Hen hen = null;
//在此编写你的代码
if(continent.equals("北美洲") ){
hen = new NorthAmericanHen();
}
else if (continent.equals("欧洲")){
hen = new EuropeanHen();
}
else if (continent.equals("亚洲")){
hen = new AsianHen();
}
else if (continent.equals("非洲")){
hen =new AfricanHen();
}
return hen;
}
}
}