Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using enum and setting depends on other classes
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Titre:
Using enum and setting depends on other classes
Divers
Thread ID:
01090259
Message ID:
01090259
Vues:
53
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
}

// set member productvariant: (for now hardcoded, but how to set it using communication with other classes (because there it is set):

EProducts mProduct = EProducts.ProductA;

function double Premium(int age, int duraion){
// code

}
function double RiskPremium(int age,int duration){
// dependent on the product variant do an alghortim.
switch(mProduct){
case EProducts.ProductA:
  // alghoritm A

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.
Zakaria al Azhar
My blog on Actuaris.net
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform