ку
package com.javarush.task.task14.task1408;
/*
Куриная фабрика
*/
public class Solution {
public static void main(String[] args) {
Hen hen = HenFactory.getHen(Country.BELARUS);
hen.getCountOfEggsPerMonth();
System.out.println(hen.getDescription());
}
static class HenFactory implements Country{
static Hen getHen(String country) {
Hen hen = null;
if(country.equals(BELARUS)){
return new BelarusianHen();
}
if(country.equals(MOLDOVA)){
return new MoldovanHen();
}
if(country.equals(UKRAINE)){
return new UkrainianHen();
}
if(country.equals(RUSSIA)){
return new RussianHen();
}
return hen;
}
}
}