An analyst told me that I need to create classes that calculate contract installments, but I realized that this calculation always takes the same steps, but depending on the type of contract, some steps are done in different ways. The steps that I could identify are: CalcValorPrincipal
, CalcTaxaAdministrativa
and CalcValorSeguro, after executing them the algorithm sums everything up and returns the total value of the contract. I would like to know what the recommended design pattern is to solve this problem and why is it recommended? I've been searching and it seemed like a template mode, but I'd like some help from those who "handle" more of this area.
I would like a UML diagram of this problem using the recommended pattern so that it can get a little clearer for me.