Universal generator

Hey,

I’ve got several tasks to make, and I’ve got a problem with this one:

The problem is about being independent. I was thinking about making one class and all the others to inherit from it. But I don’t think that’s the way. Anyone has any idea to make it?

Thanks a lot in advance

You have 2 classes that don’t inherit from one another.

This is basically a randomized version of the ‘factory pattern’:

Only thing is your assignment is saying that the ‘createProduct’ (in that link) method also randomizes the properties. And that the factory should have properties on itself to define ranges for those random values.

1 Like

Thanks a lot!