I tried various combinations (continent in english, puttting spaces or ponctuation...) like @thesouv or @David... with no luck
My output seams to fit the requirements :
Je suis une poule. Je viens d'Afrique. Je ponds 4 œufs par mois.
Je suis une poule. Je viens d'Europe. Je ponds 2 œufs par mois.
Je suis une poule. Je viens d'Asie. Je ponds 3 œufs par mois.
Je suis une poule. Je viens d'Amérique du Nord. Je ponds 1 œufs par mois.
package fr.codegym.task.task14.task1408;
/*
Usine de poules
*/
public class Solution {
public static void main(String[] args) {
Hen africanHen = HenFactory.getHen(Continent.AFRICA);
africanHen.getMonthlyEggCount();
System.out.println(africanHen.getDescription());
Hen europeanHen = HenFactory.getHen(Continent.EUROPE);
europeanHen.getMonthlyEggCount();
System.out.println(europeanHen.getDescription());
Hen asianHen = HenFactory.getHen(Continent.ASIA);
asianHen.getMonthlyEggCount();
System.out.println(asianHen.getDescription());
Hen northAmericanHen = HenFactory.getHen(Continent.NORTHAMERICA);
northAmericanHen.getMonthlyEggCount();
System.out.println(northAmericanHen.getDescription());
}
static abstract class HenFactory {
static Hen getHen(String continent) {
Hen hen = null;
//écris ton code ici
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;
}
return hen;
}
}
}