WXME0106 ## &wxtext wxtab wxmedia wximage  $(lib "comment-snip.ss" "framework")  +(lib "collapsed-snipclass.ss" "framework")   drscheme:sexp-snip   drscheme:syntax-snipclass%  drscheme:number  ,(lib "number-snip.ss" "drscheme" "private")   drscheme:bindings-snipclass%  drscheme:lambda-snip%  drscheme:define-snip%  gb:core  
gb:canvas  gb:editor-canvas  
gb:slider  	gb:gauge  gb:listbox  gb:radiobox  
gb:choice  gb:text  gb:message  
gb:button  gb:checkbox  gb:vertical-panel  	gb:panel  gb:horizontal-panel  !(lib "readable.ss" "guibuilder")  java-comment-box%  java-interactions-box%  "drscheme:vertical-separator-snip%  wxbad   drscheme:xml-snip  (lib "xml-snipclass.ss" "xml")  drscheme:scheme-snip  "(lib "scheme-snipclass.ss" "xml")  test-case-box%  wxloc        K         
ZZ                                                        	Standard  KCourier New         
ZZ                                                          ?       \                              ?      ?      ?      ""   Matching Parenthesis Style   ?       \                              ?      ?      ?      ""      ?                                     ?      ?      ?      &&   (framework:syntax-coloring:scheme:symbol   ?                                     ?      ?      ?      &&   )framework:syntax-coloring:scheme:keyword   ?                                     ?      ?      ?      &&      ?                                     ?      ?      ?      t   )framework:syntax-coloring:scheme:comment   ?                                     ?      ?      ?      t      ?                                     ?      ?      ?      )&   (framework:syntax-coloring:scheme:string   ?                                     ?      ?      ?      ""   *framework:syntax-coloring:scheme:constant   ?                                     ?      ?      ?      ""      ?                                     ?      ?      ?      <$   -framework:syntax-coloring:scheme:parenthesis   ?                                     ?      ?      ?      <$      ?                                     ?      ?      ?      @   'framework:syntax-coloring:scheme:error   ?                                     ?      ?      ?      @      ?                                     ?      ?      ?            'framework:syntax-coloring:scheme:other   ?                                     ?      ?      ?               ?                                     ?      ?      ?      Qp   1drscheme:check-syntax:lexically-bound-identifier   ?                                     ?      ?      ?      Qp      ?                                     ?      ?      ?      D    *drscheme:check-syntax:imported-identifier   ?                                     ?      ?      ?      D    %profj:syntax-coloring:scheme:keyword   ?                                     ?      ?      ?               ?                                     ?      ?      ?      ""   $profj:syntax-coloring:scheme:string   ?                                     ?      ?      ?      ""   %profj:syntax-coloring:scheme:literal   ?                                     ?      ?      ?      ""   %profj:syntax-coloring:scheme:comment   ?                                     ?      ?      ?      t   #profj:syntax-coloring:scheme:error   ?                                     ?      ?      ?      @   (profj:syntax-coloring:scheme:identifier   ?                                     ?      ?      ?      &&   %profj:syntax-coloring:scheme:default   ?                                     ?      ?      ?              F ?             ?      ?      ?      ?      ?      ?            XML  F ?             ?      ?      ?      ?      ?      ?              G ?             ?      ?      ?      ?      ?      ?               ?                                    ?      ?      ?      PP     G ?                                    ?      ?      ?      PP     G ?                                     ?      ?      ?       d       KCourier New         
ZZ                                                          ?                                     ?      ?      ?              ?                                     ?      ?      ?               ?                                     ?      ?      ?               ?                                     ?      ?      ?               ?                                     ?      ?      ?               ?                                     ?      ?      ?               ?                                     ?      ?      ?      ""      ?                                     ?      ?      ?      ""      ?                                     ?      ?      ?      ""      ?                                     ?      ?      ?      ""      ?                                                                   ?                                                                   ?                                                                   ?                                                                   ?                                                                   ?                                                                	   ?                                                                   ?                                                             ""   KCourier New         
      ?      ?      ?      ?      ?      ?              F ?       \ZZZ                              ?      ?      ?      ""     F ?       ZZZZ      ?      ?      ?      ?      ?      ?                ?             ?      ?      ?      ?      ?      ?               K         
ZZ                                                           ?       \                              ?      ?      ?      (     F ?       \ZZZ                              ?      ?      ?      (   drscheme:check-syntax:keyword  F ?       \ZZZ                              ?      ?      ?      (     F ?       ZZZZ                              ?      ?      ?      @   'drscheme:check-syntax:unbound-variable  F ?       ZZZZ                              ?      ?      ?      @      ?                                     ?      ?      ?      $$     F ?       ZZZZ                              ?      ?      ?      $$   %drscheme:check-syntax:bound-variable  F ?       ZZZZ                              ?      ?      ?      $$    drscheme:check-syntax:primitive  F ?       ZZZZ                              ?      ?      ?      $$      ?                                     ?      ?      ?      3'     F ?       ZZZZ                              ?      ?      ?      3'   drscheme:check-syntax:constant  F ?       ZZZZ                              ?      ?      ?      3'      ?       \                              ?      ?      ?           drscheme:check-syntax:tail-call   ?       \                              ?      ?      ?            F ?       ZZZZ                              ?      ?      ?      <$   drscheme:check-syntax:base  F ?       ZZZZ                              ?      ?      ?      <$     K ?                                     ?      ?      ?       d       KCourier New         
ZZ                                                           K         ZZZZ                                                           K-adobe-courier         ZZZZ                                                          F ?       ZZZZ                              ?      ?      ?      @     F ?       ZZZZ                              ?      ?      ?      $#     F ?       ZZZZ                              ?      ?      ?      >&     G ?       ZZZZ      ?      ?      ?      ?      ?      ?              F ?       ZZZZ                             ?      ?      ?      QQ     G ?       ZZZZ                             ?      ?      ?      QQ     G ?       ZZZZ                              ?      ?      ?       d       K         
ZZZZ                                                           KCourier New         ZZZZ                                                          F ?       ZZZZ                             ?      ?      ?      PP     G ?       ZZZZ                             ?      ?      ?      PP      KCourier         ZZZZ                                                           KCourier         ZZZZ                                                          F ?       \ZZZ                                                           F ?       \ZZZ                              ?      ?      ?             F ?       ZZ^Z                              ?      ?      ?             F ?       ZZZZ                              ?      ?      ?             F ?       \ZZZ                              ?      ?      ?            K ?       ZZZZ      ?      ?      ?      ?      ?      ?               KVT100         ZZZZ                                                           K ?       ZZZZ      ?      ?      ?      ?      ?      ?              K ?       ZZZZ                              ?      ?      ?       d      F ?       ZZZZ                             ?      ?      ?              F ?       ZZZZ                              ?      ?      ?             F ?       ZZZZ                              ?      ?      ?             F ?       ZZZZ                              ?      ?      ?      **     F ?       ZZZZ                             ?      ?      ?             G ?       ZZZZ                             ?      ?      ?             F ?       ZZZZ                              ?      ?      ?              F         ZZZZ      ?      ?      ?      ?      ?      ?               F ?       ZZZZ                             ?      ?      ?            h-link-style  F ?       ZZZZ                             ?      ?      ?             F @        \ZZZ      ?      ?      ?      ?      ?      ?               F ?       \ZZZ      ?      ?      ?      ?      ?      ?            r p   F ?      ZZZZ      ?      ?      ?      ?      ?      ?            t ps  F ?       ZZZZ                              ?      ?      ?      22      F ?       ZZ]Z      ?      ?      ?      ?      ?      ?              F ?       ZZ]Z                              ?      ?      ?      @   x pq pz  K ?       ZZZZ      ?      ?      ?      ?      ?      ?            z  K ?       \ZZZ      ?      ?      ?      ?      ?      ?              K ?       ZZZZ                              ?      ?      ?      >&     K ?       ZZZZ                              ?      ?      ?      $#     F ?      ZZZZ      ?      ?      ?      ?      ?      ?              K ?       ZZZZ                              ?      ?      ?      ""    p  F ?       ZZ]Z      ?      ?      ?      ?      ?      ?               F ?       ZZZZ      ?      ?      ?      ?      ?      ?               F ?       ZZZZ      ?      ?      ?      ?      ?      ?               F ?       ZZZZ      ?      ?      ?      ?      ?      ?                 ?             ?      ?      ?      ?      ?      ?               ?             ?      ?      ?      ?      ?      ?               F         
ZZ                                                           ?       ^                              ?      ?      ?              ?                                     ?      ?      ?              ?                                     ?      ?      ?             F         
ZZ                                                         F @        \      ?      ?      ?      ?      ?      ?              F ?       \      ?      ?      ?      ?      ?      ?              F ?       \                             ?      ?      ?             F ?            ?      ?      ?      ?      ?      ?              F ?                                   ?      ?      ?             F ?       \                             ?      ?      ?      22     F ?       ]      ?      ?      ?      ?      ?      ?              F ?33@    \      ?      ?      ?      ?      ?      ?              F ?                                    ?      ?      ?             K ?                                     ?      ?      ?      <$     K ?       \                              ?      ?      ?             K ?                                    ?      ?      ?      <$     K ?       \                             ?      ?      ?              ?       \                                                           K ?       \      ?      ?      ?      ?      ?      ?              F ?                                     ?      ?      ?      ""     F ?       \                              ?      ?      ?      ""     K ?                                    ?      ?      ?             F ?       ]                              ?      ?      ?      @     F ?       ]                             ?      ?      ?           	   ?                                     ?      ?      ?               ?                                     ?      ?      ?      ""      ?                                                                L   ?                                     ?      ?      ?            ?   ?                                     ?      ?      ?            D   ?                                     ?      ?      ?            L   ?                                                                ?   ?                                                                D   ?                                                                   ?       \]                             ?      ?      ?            syntax-coloring:Java:keyword   ?       \]                             ?      ?      ?               ?       \]                             ?      ?      ?       d    syntax-coloring:Java:string   ?       \]                             ?      ?      ?       d    syntax-coloring:Java:literal   ?       \]                             ?      ?      ?       d       ?       \]                             ?      ?      ?      iii   syntax-coloring:Java:comment   ?       \]                             ?      ?      ?      iii      ?       \]                             ?      ?      ?      @   syntax-coloring:Java:error   ?       \]                             ?      ?      ?      @      ?       \]                             ?      ?      ?            syntax-coloring:Java:identifier   ?       \]                             ?      ?      ?              ?       \]                             ?      ?      ?         syntax-coloring:Java:default   ?       \]                             ?      ?      ?            K         ZZ                                                          ?                                     ?      ?      ?      **      ?                                     ?      ?      ?              ?                                    ?      ?      ?            G ?                                    ?      ?      ?             F         ZZ                                                                        ///  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  /  
  a  b  s  t  r  a  c  t     c  l  a  s  s     A  M  a  i  l     {  
      i  n  t     w  e  i  g  h  t  ;  
        i  n  t     r  a  t  e  ;  
  
                	 	Template:  
  ...other.weight...  
  ...other.rate...  
  ...other.basePrice()...  
  ...other.actualPrice()...       
  
        /  /     c  o  m  p  u  t  e     t  h  e     b  a  s  e     p  r  i  c  e     o  f     p  o  s  t  a  g  e     f  o  r     t  h  i  s     i  t  e  m  
        i  n  t     b  a  s  e  P  r  i  c  e  ()     {  
              r  e  t  u  r  n     th  is  .  wei  ght     *     th  i  s  .  rate  ;  
        }  
  
        /  /     c  o  m  p  u  t  e     t  h  e     a  c  t  u  a  l     p  r  i  ce of     p  o  s  t  a  g  e     f  o  r     t  h  i  s     i  t  e  m  
        a  b  s  t  r  a  c  t     i  n  t     a  c  t  u  a  l  P  r  i  c  e  ()  ;  
  
        /  /     d  e  t  e  r  m  i  n  e     i  f   t  h  e   p  o  s  t  a  g  e     f  o  r     t  h  i  s     i  t  e  m     i  s     l  e  s  s     t  h  a  n   f  o  r     o  t  h  e  r     g  i  v  e  n     i  t  e  m  
        b  o  o  l  e  a  n     i  s  C  h  e  a  p  e  r  (  A  M  a  i  l     o  t  h  e  r  )  {  
              r  e  t  u  r  n     t  h  i  s  .  a  c  t  u  a  l  P  r  i  c  e  (  )     <     o  t  h  e  r  .  a  c  t  u  a  l  P  r  i  c  e  (  )  ;           
        }     
  
        }  
  
  
  c  l  a  s  s     L  e  t  t  e  r     e  x  t  e  n  d  s     A  M  a  i  l     {  
      i  n  t     f  ee  s  ;  
  
      Le  t  te  r     (i  n  t     w  ei  g  h  t  ,     i  n  t     r  at  e  ,     i  n  t     f  e  e  s  )     {  
          t  h  i  s  .  wei  g  h  t     =     w  ei  g  h  t  ;  
          t  h  i  s  .  r  at  e     =     r  at  e  ;  
            thi  s  .  f  ee  s     =     f  ees  ;  
        }  
  
   )        # Template  
  ...  this  .  wei  g  h  t  ...  
  ...  this  .  r  at  e  ...  
  ...  this  .  f  ees  ...  
  ...  this  .  basePrice()  ...  
  ...this.  actualPrice  ()...       
  
        //     c  o  m  p  u  t  e     t  h  e     a  c  t  u  a  l     p  r  i  c  e     o  f     p  o  s  t  a  g  e     f  o  r     t  h  i  s     l  e  t  t  e  r  
        i  n  t     actualPrice  (){  
              r  e  t  u  r  n     t  h  i  s  .  b  a  s  e  P  r  i  c  e  ()     +     t  h  i  s  .  f  e  e  s  ;  
        }  
  
  }  
  
    v            AMail ltr1   = new   Letter  (  2  ,   2  0  ,   120  )  ;       
    t            AMail ltr2   = new   Letter  (  3  ,   2  0  ,   0  )  ;       
  
    D            )"Testing the methods in the Letter class"       
    J            ltr1  .  	basePrice  () ==   4  0       
    U        	    ltr2  .  base  Price  () ==   6  0          
  
    H            ltr1  .  actualPrice  () ==   160       
    R            ltr2  .  actualPrice  () ==   6  0          
  
    e            ltr2  .  	isCheaper  (  ltr1  )     ==   true          
    f            ltr1  .  	isCheaper  (  ltr2  )     ==   false          
  
  c  l  a  s  s     A  d     e  x  t  e  n  d  s     A  M  a  i  l     {  
  
        A  d     (i  n  t     w  ei  g  h  t  ,     i  n  t     r  at  e  )     {  
            t  h  i  s  .  wei  g  h  t     =     w  ei  g  h  t  ;  
            t  h  i  s  .  r  at  e     =     r  at  e  ;  
        }  
  
             Template  
  ...  this  .  wei  g  h  t  ...  
  ...  this  .  r  at  e  ...  
  ...  this  .  basePrice()  ...  
  ...this.  actualPrice  ()...       
  
        //     c  o  m  p  u  t  e     t  h  e     a  c  t  u  a  l     p  r  i  c  e     o  f     p  o  s  t  a  g  e     f  o  r     t  h  i  s     p  i  e  c  e     o  f     a  d  v  e  r  t  i  s  e  m  e  n  t  
        i  n  t     actualPrice  (){  
              r  e  t  u  r  n     t  h  i  s  .  b  a  s  e  P  r  i  c  e  ()  ;  
        }  
  
  }  
  
    ]        
    
AMail ad1   = new   Ad  (  2  ,   10  )  ;       
    b            
AMail ad2   = new   Ad  (  8  ,   2  0  )  ;       
  
    @            %"Testing the methods in the Ad class"       
    Y        
    ad1  .  base  Price  ()     ==   20          
    T        	    ad2  .  base  Price  ()     ==   160       
  
    V        	    ad1  .  actualPrice  ()     ==   20          
    Q            ad2  .  actualPrice  ()     ==   160       
  
    c            ad1  .  	isCheaper  (  ad2  )     ==   true          
    d            ad2  .  	isCheaper  (  ad1  )     ==   false          
  
  c  l  a  s  s     P  a  c  ka  g  e     e  x  t  e  n  d  s     A  M  a  i  l     {  
      i  n  t     i  n  s  Amo  u  nt  ;              // in   h  un  dr  ed  s o  f d  ollars  
      i  n  t     i  nsR  a  t  e  ;                    // pe  r 1  00 doll  ar  s  
  
        P  a  c  ka  g  e     (i  n  t     w  ei  g  h  t  ,     in  t     r  at  e  ,     i  n  t     i  ns  Am  o  u  n  t  ,     i  n  t     i  n  s  Ra  t  e  )     {  
            t  h  i  s  .  wei  g  h  t     =     w  ei  g  h  t  ;  
            t  h  i  s  .  r  at  e     =     r  at  e  ;  
              thi  s  .  i  n  s  Amo  u  nt     =     i  n  s  Amo  u  nt  ;        
              thi  s  .  i  nsR  a  t  e     =     i  nsR  a  t  e  ;                    
        }  
  
   x        . Template  
  ...  this  .  wei  g  h  t  ...  
  ...  this  .  r  at  e  ...  
  ...  this  .  insAm  ount  ...  
  ...  this  .  i  n  s  Ra  t  e  ...  
  ...  this  .  basePrice()  ...  
  ...this.  actualPrice  ()...       
  
        //     c  o  m  p  u  t  e     t  h  e     a  c  t  u  a  l     p  r  i  c  e     o  f     p  o  s  t  a  g  e     f  o  r     t  h  i  s     p  a  c  k  a  g  e  
        i  n  t     actualPrice  (){  
              r  e  t  u  r  n     t  h  i  s  .  b  a  s  e  P  r  i  c  e  ()     +     t  h  i  s  .  i  n  s  A  m  o  u  n  t     *     t  h  i  s  .  i  n  s  R  a  t  e  ;  
        }  
  }  
  
                AMail   pkg1   = new   P  a  c  ka  g  e  (  24  ,   10  ,   5  ,   30  )  ;       
                AMail pkg2   = new   P  a  c  ka  g  e  (  30  ,   10  ,   6  ,   25  )  ;       
  
    h        	    "Testing the methods in the   P  a  c  ka  g  e   class"       
    V        	    pkg1  .  	basePrice  ()     ==   240          
    [        
    pkg2  .  	basePrice  ()     ==   30  0          
  
    X        	    pkg1  .  actualPrice  ()     ==   390          
    X        	    pkg2  .  actualPrice  ()     ==   450          
  
    e            pkg1  .  	isCheaper  (  pkg2  )     ==   true          
    f            pkg2  .  	isCheaper  (  pkg1  )     ==   false          
  
    C            ("Testing the methods in the AMail class"       
    f            pkg1  .  	isCheaper  (  ltr1  )     ==   false          
    e            ltr1  .  	isCheaper  (  pkg1  )     ==   true          
    e            ltr1  .  	isCheaper  (  ad2  )     ==   false          
  
     
