home *** CD-ROM | disk | FTP | other *** search
/ PC World 1998 December / PCWorld_1998-12_cd.iso / software / sybase / ASA / asa60.exe / data1.cab / jxmp_files / Invoice.java < prev    next >
Text File  |  1998-07-27  |  896b  |  34 lines

  1. /****************************************************************/
  2. /*  Invoice class: for use with Adaptiver Server Anywhere       */
  3. /*  documentation, chapter "Welcome to Java in the database"    */
  4. /****************************************************************/
  5.  
  6. public class Invoice {
  7.  
  8.     //Fields
  9.     public String lineItem1Description;
  10.     public double lineItem1Cost;
  11.  
  12.     public String lineItem2Description;
  13.     public double lineItem2Cost;
  14.  
  15.     //An instance method
  16.     public double totalSum() {
  17.         double runningsum;
  18.         double taxfactor = 1 + Invoice.rateOfTaxation();
  19.  
  20.         runningsum = lineItem1Cost + lineItem2Cost;
  21.         runningsum = runningsum * taxfactor;
  22.  
  23.         return runningsum;
  24.     }
  25.  
  26.     //A class method
  27.     public static double rateOfTaxation() {
  28.         double rate;
  29.         rate = .15;
  30.  
  31.         return rate;
  32.     }
  33. }
  34.