CodeGym /Java Course /Java Core /Bonus task | Lesson 6 | Level 4

Bonus task | Lesson 6 | Level 4

Java Core
Level 4 , Lesson 6
Available

"What? You figured that out already?! You can't just go and complete all my tasks. It seems to me that you're just fooling around. Here's a new task for you. It's very difficult. Pay attention and arrange everything systematically. Read the literature, and ask your friends! Nobody dares deceive the Great Diego!"

16
Task
Java Core, level 4, lesson 6
Locked
Chicken factory
Let's create an international chicken factory. We'll fill it with chickens from all over the world. Create a list that indicates each hen's nationality and we'll track how many eggs they lay each month. How do you do that? Using abstract classes and inheritance, of course.
Comments (67)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
O H Level 24, Germany, Germany
3 January 2025
For me it was easy, but im doing it on my phone, so i have hints. It took 2 attempts tho bcuz i accidentally mixed the Continent and String types
Stas Orehov Level 22, United Kingdom, United Kingdom
12 December 2023
Good task. though i failed it many times because of lack of space: "I come from continent." instead of : " I come from continent." feel annoyed
Untitled by Anon Level 49, Germany
4 May 2023
Great task. I failed the first attempted because I wrote "I lay n eggs per month" vs. "I lay n eggs a month".
Krzysiek Nowak Level 33, Poland, Poland
26 April 2023
why switch method introduced in Java 14 is not accepted in the solution?
Rene Level 28, Netherlands
14 May 2024
I had same issue and switched (no pun intended) to the if-else to get it accepted. It ran fine with switch statement in IntelliJ. Heck, IntelliJ even suggested to change my if-else into switch.
manny9876 Level 35, Israel
14 February 2023
Thank goodness for the " correct solution" button!
Tasmoda Level 28, Midrand, South Africa
10 June 2022
I enjoyed analysing this problem.👌
Jcode Level 27, United Kingdom
6 April 2022
Great task, although watch out, the verification even checks the return string. Spot the difference... "I am a chicken" "I am a chicken."
whoseunassailable Level 28, India, India
2 March 2022
the task seemed easy for me. The place where i had to give up on it is i never thought about using the switch statement instead made different variables hen, hen2, hen3 & hen4 and then assigned them different hentypes. Is there a way by which we can solve it not using the switch statements.
whoseunassailable Level 28, India, India
2 March 2022
ohhh anyways i realised that i can use the if condition.So nvm.
John Level 17, Mansfield, Philippines
2 June 2021
Finnaly finished this taks but im confused why it works to just call the getMonthlyEggCount() by typing just that in the getDescription even if its not static?
ImDevin Level 15, Old Town, United States
9 June 2021
I wondered about that too and after doing some searching, found that if there's no access modifier, the method is default, which is Package-Private, meaning it is accessible within the same package, so you can call it just by the method name.
Jurij Thmsn Level 29, Flensburg, Germany
22 February 2021
Tough task due to complexity and text issues. Really nice! Didn't understand why the continents were in an interface though .... (?)