home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / WDESAMPL.BIN / Section.java < prev    next >
Text File  |  1997-08-23  |  580b  |  38 lines

  1. /**
  2.  * An employee section object. Allows creation, validation, and ordering of employee sections.
  3.  */
  4.  
  5. public class Section
  6. {
  7.     int val;
  8.     final static int MAX_LENGTH = 10;
  9.  
  10.     Section(int a)
  11.     {
  12.         val = a;
  13.     }
  14.  
  15.     Section(String a)
  16.     throws NumberFormatException
  17.     {
  18.         System.out.println("Parsing section; a='" + a + "' (" + a.length() + " chars)");
  19.         val = Integer.parseInt(a.trim());
  20.     }
  21.  
  22.     int value()
  23.     {
  24.         return val;
  25.     }
  26.  
  27.     public boolean isValid()
  28.     {
  29.         return val > 0;
  30.     }
  31.  
  32.     public boolean isGreaterThan(Section a)
  33.     {
  34.         return val > a.value();
  35.     }
  36. }
  37.  
  38.