Could you please check my code? I don't know why even first three test don't pass? I think that my code is correct
package pl.codegym.task.task14.task1408;
/*
Ferma drobiu
*/
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(Continent.EUROPE)) {
hen = new EuropeanHen();
} else if(continent.equals(Continent.NORTHAMERICA)) {
hen = new NorthAmericanHen();
} else if(continent.equals(Continent.AFRICA)) {
hen = new AsianHen();
} else if(continent.equals(Continent.AFRICA)) {
hen = new AfricanHen();
}
return hen;
}
}
public static abstract class Hen {
abstract int getMonthlyEggCount();
public String getDescription() {
return "Jestem kurczakiem.";
}
}
public static class NorthAmericanHen extends Hen {
@Override
public int getMonthlyEggCount() {
return 5;
}
@Override
public String getDescription() {
return super.getDescription() + " Pochodzę z " + Continent.NORTHAMERICA + ". Znoszę " + getMonthlyEggCount() + " jaj na miesiąc.";
}
}
public static class EuropeanHen extends Hen {
@Override
public int getMonthlyEggCount() {
return 9;
}
@Override
public String getDescription() {
return super.getDescription() + " Pochodzę z " + Continent.EUROPE + ". Znoszę " + getMonthlyEggCount() + " jaj na miesiąc.";
}
}
public static class AsianHen extends Hen {
@Override
public int getMonthlyEggCount() {
return 2;
}
@Override
public String getDescription() {
return super.getDescription() + " Pochodzę z " + Continent.ASIA + ". Znoszę " + getMonthlyEggCount() + " jaj na miesiąc.";
}
}
public static class AfricanHen extends Hen {
@Override
public int getMonthlyEggCount() {
return 9;
}
@Override
public String getDescription() {
return super.getDescription() + " Pochodzę z " + Continent.AFRICA + ". Znoszę " + getMonthlyEggCount() + " jaj na miesiąc.";
}
}
}