コード例 #1
0
 public PurchasePolicy parseRegular(PolicyEntry p)
 {
     if (p.getType() == "min")
     {
         MinAmountPurchase policy = new MinAmountPurchase(p.getAmount(), p.getPolicyID());
         return(policy);
     }
     else if (p.getType() == "max")
     {
         MaxAmountPurchase policy = new MaxAmountPurchase(p.getAmount(), p.getPolicyID());
         return(policy);
     }
     else
     {
         TotalPricePolicy policy = new TotalPricePolicy(p.getAmount(), p.getPolicyID());
         return(policy);
     }
 }
コード例 #2
0
        private int howManyComplex(IEnumerable <PolicyEntry> policyEntries)
        {
            int count = 0;

            for (int i = 0; i < policyEntries.Count(); i++)
            {
                PolicyEntry p = policyEntries.ElementAt(i);
                if (p.getType() == "complex")
                {
                    count++;
                }
            }
            return(count);
        }