В общем вот так сделал, друзья-но не работает. Как и многие - готов уже монитор разбить себе об голову :-)))))
поможайте :-)
package com.javarush.task.task14.task1408;
/*
Куриная фабрика
*/
public class Solution
{
public static void main(String[] args) {
Hen hen = HenFactory.getHen(Country.BELARUS);
hen.getCountOfEggsPerMonth();
}
static class HenFactory {
static Hen getHen(String country) {
Hen hen = null;
if (country.equals(Country.RUSSIA)) { return new RussianHen(); }
if (country.equals(Country.UKRAINE)) { return new UkrainianHen(); }
if (country.equals(Country.MOLDOVA)) { return new MoldovanHen(); }
if (country.equals(Country.BELARUS)) { return new BelarusianHen(); }
return hen;
}
}
public static abstract class Hen
{
public abstract int getCountOfEggsPerMonth();
public String getDescription()
{
return "Я - курица.";
}
}
}