Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1. public class DriversLicense extends IDCard {
  2.    
  3.     public static int currentYear = 2016; //the current year (can be updated)
  4.     private int expYear; //the expiration year
  5.    
  6.     /**
  7.      * default constructor for DriversLicense
  8.      */
  9.     public DriversLicense() {
  10.         super();
  11.         expYear = 0;
  12.     }
  13.    
  14.     /**
  15.      * modified constructor for DriversLicense
  16.      * @param n the name of the person
  17.      * @param y the expiration year
  18.      */
  19.     public DriversLicense(String n, String id, int y) {
  20.         super(n, id);
  21.         expYear = y;
  22.     }
  23.    
  24.     /**
  25.      * checks to see if the card is expired
  26.      * @return expiration status
  27.      */
  28.     public boolean isExpired() {
  29.         return (currentYear > expYear) ? true : false;
  30.     }
  31.    
  32.     /**
  33.      * gets the expiration year
  34.      * @return expYear the expiration year
  35.      */
  36.     public int getExpYear() {
  37.         return expYear;
  38.     }
  39.    
  40.     /**
  41.      * gets the current year
  42.      * @return currentYear the current year
  43.      */
  44.     public int getCurrentYear() {
  45.         return currentYear;
  46.     }
  47.    
  48.     /**
  49.      * updates the expiration date for renewal
  50.      * @param y the new expiration year
  51.      */
  52.     public void updateExpYear(int y) {
  53.         expYear = y;
  54.     }
  55.    
  56.     /**
  57.      * changes the current year
  58.      * @param y the new current year
  59.      */
  60.     public static void updateCurrentYear(int y) {
  61.         currentYear = y;
  62.     }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement