Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DriversLicense extends IDCard {
- public static int currentYear = 2016; //the current year (can be updated)
- private int expYear; //the expiration year
- /**
- * default constructor for DriversLicense
- */
- public DriversLicense() {
- super();
- expYear = 0;
- }
- /**
- * modified constructor for DriversLicense
- * @param n the name of the person
- * @param y the expiration year
- */
- public DriversLicense(String n, String id, int y) {
- super(n, id);
- expYear = y;
- }
- /**
- * checks to see if the card is expired
- * @return expiration status
- */
- public boolean isExpired() {
- return (currentYear > expYear) ? true : false;
- }
- /**
- * gets the expiration year
- * @return expYear the expiration year
- */
- public int getExpYear() {
- return expYear;
- }
- /**
- * gets the current year
- * @return currentYear the current year
- */
- public int getCurrentYear() {
- return currentYear;
- }
- /**
- * updates the expiration date for renewal
- * @param y the new expiration year
- */
- public void updateExpYear(int y) {
- expYear = y;
- }
- /**
- * changes the current year
- * @param y the new current year
- */
- public static void updateCurrentYear(int y) {
- currentYear = y;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement