dimanche 14 octobre 2018

Which design pattern I should use for a hierarchical credit card system?

I need to implement a credit card system using some design pattern, but I'm having some problems figuring out which one.

There is a type of hierarchy, where to have a card it is necessary to have a "minor version" first. I am in doubt between using Bridge or Composite, but I do not know if I'm on the right way.

  • A national card has an annual fee and a limit;
  • An international card has all that a national card, besides they can be used abroad and the anual fee is the double. It is possible to make withdrawals abroad for a fee and you must have a national card to have an international card;
  • A gold card has all that an international card, besides a travel insurance and the anual fee is the double. You must have an international card to have a gold card.

I need to implement an abstract class Card and then NationalCard, InternationalCard and GoldCard implements it?

Aucun commentaire:

Enregistrer un commentaire