Hi All,
I'm developing a calculation class, many of the calculation methods depends on the settings from other classes (objects??, sorry for using the wrong terms..I'll try to explain what I mean).
The other classes are mostly user interface classes. The idea is that a user chooses an insurance type product, afterwards the choise is given to the calculation object and the object returns the premium. The premium method in the calculation class is derived from the method "RiskPremium" in the same calculation class. The calculation of the RiskPremium depends on the insurance type product choise of the user. I don't know how the other classes are implemented, but that isn't important for me (right?). I know that there are three product variants :"a,b,c". I have defined these variants as a public member enum in my class and use it in the class methods. For example:
class Calculations{
public enum EProducts{
ProductA,
ProductB,
ProductC
}
EProducts mProduct = EProducts.ProductA;
function double Premium(int age, int duraion){
}
function double RiskPremium(int age,int duration){
switch(mProduct){
case EProducts.ProductA:
etcetera
}
}
I was wondering if this the right way to do this. And if there are better options. Sorry for the messy message, if you need more info please ask...
Thanks.