A scary fairy tale

  • 6
  • Locked
Once there were five classes: red riding hood, grandmother, pie, woodcutter, and wolf. Each class has 2 fields: ArrayList killed and ArrayList ate. Create the necessary objects (hood, grandmother, ...). Then arrange the relationships correctly according to who ate and/or killed who to bring to life what happened in the old Terran fairy tale "Little Red Riding Hood".
You can't complete this task, because you're not signed in.
Comments (20)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Franco Polizzi
Level 10 , Werther, Germany
25 December 2022, 02:09
Very bad problem description.
Level 10 , Dresden, Germany
23 November 2021, 20:40
Good idea to use storytelling for explaining why and when to use abstract classes. But the tasks need some specification. Without a proper tasklist, you need luck to get your solution validated.
Level 15 , Old Town, United States
12 May 2021, 16:15
the wolf ate a little --> does putting this in serve a purpose? is CG trying to teach us not to get fooled?
Karas Java Developer
2 December 2020, 01:18
It changed one of the few found memories I had from when I was a kid.
Level 41
13 November 2020, 13:10
So, the logic behind this exercise (in the beginning I did not like it at all but ended up understanding and liking) is to realise that the abstract class StoryItem is the main class for all of the characters (subclasses) from the story, ergo, all of the other characters will have these arraylists. After a bit of research about the story and finding out that wolf ate grandma and hood and was killed (in some versions at least lol) by the woodcutter, I had to translate this storyline in the logic of the problem. So, if each character has an arraylist of killed and ate whom do we add where ? Well, the wolf ate the grandma and the hood. We in main, we have to add grandma and hood to wolf's ate arraylist. And the wolf was killed by the woodcutter so we have to add the wolf to the woodcutter's killed arraylist. The end. :)
Drazen Jankovic
Level 11 , München, Germany
28 May 2021, 01:55
Thanks dude, that was enlightening... 👍
Level 41
28 May 2021, 18:09
You're welcome! Glad you found it useful. 😁
Level 34 , Utrecht, Netherlands
14 July 2020, 13:28
unexpectedly, the wolf ate the hood too :)
Level 23 , Phoenix, United States
20 December 2019, 20:01
Real pointless challenge. How is anyone supposed to figure out what wolf ate a little means without going through the comments and help section?
Level 13 , Bangalore, India
14 November 2019, 05:57
ignore pie use killed, ate correctly
Kyle Chatman
Level 11 , Oakland, United States
24 May 2019, 18:30
Clarifying poorly written conditions: wolf ate grandmother wolf ate hood woodcutter killed wolf. Ignore the nonsense about the pie.
Syed Tayyab ul Mazhar
Level 12 , Karachi, China
15 June 2019, 15:52
Thanks. Took me 10 attempts.
11 January 2020, 07:27
it took single attempt! all b'coz of you, thanks man!
Lucas Hoage
Level 14 , Savannah, United States
5 June 2020, 23:44
I came to that same conclusion, I just wasn't sure. I went and read the folk tale.
Juanf Software Developer at EPAM
3 August 2020, 11:37
Yes, we're suppose to be here to learn Java, not to guess correctly what they mean ¯\_(ツ)_/¯
Level 13 , Fort Worth, United States
7 September 2021, 01:02
THANK YOU! This problem was way more confusing than what it should have been.
Level 20 , Vilnius, Lithuania
25 April 2019, 17:36
This task is confusing. Please specify what "wolf ate a little" means. Because you can't understand that a little means both hood and grandmother. Also in the story wolf never eats red riding hood!
schipplock Backend Developer at n/a
8 August 2021, 14:30
> Also in the story wolf never eats red riding hood! in your version! In the "original" tale she is being killed as well :D.