mardi 11 mai 2021

Singleton pattern java [closed]

enter image description here

Let us suppose that the association that is in charge of putting the different companies in contact with customers want to register in the system the% of profit that will be charged to each company for the moves made through your system. This% is unique, but we want to be able to change it. It asks:

a) What design pattern is appropriate to record this% profit?

b) Provide the class diagram resulting from applying this pattern (only the part of the pattern application).

c) Write the code java of the class diagram that you propose in the previous section

I have thought about using the singleton pattern, but I am not sure how to implement it. Should I use the singleton in Company? That would allow me to change the% of profit of all the companies or company. I'm a bit busy.

Aucun commentaire:

Enregistrer un commentaire