1 4 package com.openedit.store.adjustments; 5 6 import org.openedit.money.Fraction; 7 import org.openedit.money.Money; 8 9 import com.openedit.store.Cart; 10 import com.openedit.store.CartItem; 11 12 15 public class SaleAdjustment implements Adjustment 16 { 17 protected Fraction fieldPercentage; 18 19 public SaleAdjustment() 20 { 21 super(); 22 } 24 25 public Money adjust( Cart inCart, CartItem inItem ) 26 { 27 return inItem.getYourPrice().multiply( Fraction.ONE.subtract( getPercentage() ) ); 28 } 29 30 public void setPercentDiscount( double inAdjustmentPercentage ) 31 { 32 fieldPercentage = new Fraction( inAdjustmentPercentage / 100 ); 33 } 34 35 protected Fraction getPercentage() 36 { 37 return fieldPercentage; 38 } 39 40 } 41 | Popular Tags |