BEA Systems, Inc.

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

Field Summary
static double SENIOR_DISCOUNT_RATE
          The discount rate to be applied to the price
 
Constructor Summary
SeniorCitizenDiscountPolicy()
          Default constructor
 
Method Summary
 Price calculatePrice(Item item, Quantity qty, Customer customer)
          The senior citizen discount on this item is SENIOR_DISCOUNT_RATE percent.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SENIOR_DISCOUNT_RATE

public static final double SENIOR_DISCOUNT_RATE
The discount rate to be applied to the price
Constructor Detail

SeniorCitizenDiscountPolicy

public SeniorCitizenDiscountPolicy()
Default constructor
Method Detail

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 priced
qty - The quantity being priced
Throws:
java.rmi.RemoteException -  

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved