I have gone through each and every item and condition to make sure I have implemented correctly, but it fails every test. I feel like there is some type of bug or something or maybe I am just blind. All I know is it passes all the tests I made in my IDE both getEggCount and getDescription works flawlessly for each type of hen...
package com.codegym.task.task14.task1408;
/*
Chicken factory
*/
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;
switch (continent) {
case Continent.AFRICA: hen = new AfricanHen(); break;
case Continent.ASIA: hen = new AsianHen(); break;
case Continent.EUROPE: hen = new EuropeanHen(); break;
case Continent.NORTHAMERICA: hen = new NorthAmericanHen(); break;
default: hen = null;
}
return hen;
}
}
abstract static class Hen {
abstract int getMonthlyEggCount();
String getDescription() {
return "I am a chicken.";
}
}
}