I need some help to solve this: i want to calculate the total discount of a sale, and this is calculated by the sum of all the products discount in the sale, the product discount is given by the type of client and the type of product. So lets say i have client X and Y, and products, A B and C, there are six different discount, and all discounts are completely different rules for example product A has a 1% discount for every 10 grams, and B has a discount of 10% of de product.
So i want to have a sale class, with a list of product, a client, and a calculatetotaldiscount method.
I thought about creating a discount strategy, but how do i link each strategy with the right product.
vendredi 16 mars 2018
Apply strategy pattern in a Discount Example
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire