examples.businesspolicy
Class SeniorCitizenDiscountPolicy
java.lang.Object
|
+--examples.businesspolicy.SeniorCitizenDiscountPolicy
- public class SeniorCitizenDiscountPolicy
- extends java.lang.Object
- implements ItemPriceCalculationPolicy, java.io.Serializable
This class is a custom item pricing calculation policy.
When applied to an item's price, the price is discounted by
SENIOR_DISCOUNT_RATE.
This policy does not take into account the quantity of items being
priced.
- See Also:
Item
,
ItemPriceCalculationPolicy
,
BusinessPolicy
,
AprilFoolsDiscountPolicy
,
Quantity
,
Price
, Serialized Form
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
SENIOR_DISCOUNT_RATE
public static final double SENIOR_DISCOUNT_RATE
- The discount rate to be applied to the price
SeniorCitizenDiscountPolicy
public SeniorCitizenDiscountPolicy()
- Default constructor
calculatePrice
public Price calculatePrice(Item item,
Quantity qty,
Customer customer)
throws java.rmi.RemoteException
- The senior citizen discount on this item is SENIOR_DISCOUNT_RATE percent.
1.- The price is obtained from the item (It could be obtained
from an alternate DB)
2.- The price is discounted by SENIOR_DISCOUNT_RATE
3.- The price is returned
- Specified by:
- calculatePrice in interface ItemPriceCalculationPolicy
- Parameters:
item
- The item being pricedqty
- The quantity being priced- Throws:
- java.rmi.RemoteException -
Copyright © 2000 BEA Systems, Inc. All Rights Reserved