How to create a group? The apple issue.

example: We have 3 different apples 🍎 and 3 different cooks - slow, middle and fast cook all cooks should cut the apples at the same time we have the method cutApple how do I group all the apples? I want to say like: cut apples now maybe later cut peaches, than tomatoes? for all the objects I made constructors like Apple.greenApple = new Apple thank you for your help.

5th Feb 2017, 11:17 AM
Maurice Fiedler
Maurice Fiedler - avatar
1 Answer
+ 2
You can use an abstract class and extend Apple, Peach and Tomato from it. Three different cooks are simply three objects of class Cook with different cookingAbility (you could use an enum for that).
9th Feb 2017, 7:07 PM
Tashi N
Tashi N - avatar