Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active April 9, 2024 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcsee/f2f64b2f510c08a4f85a6c8cbe85de58 to your computer and use it in GitHub Desktop.
Save mcsee/f2f64b2f510c08a4f85a6c8cbe85de58 to your computer and use it in GitHub Desktop.
import java.util.Date;
public class CreditCard {
private String cardNumber;
private Date expiryDate;
public CreditCard(String cardNumber, Date expiryDate) {
// Not a complete date
this.cardNumber = cardNumber;
this.expiryDate = expiryDate;
}
public boolean isExpired() {
Date currentDate = new Date();
return expiryDate.before(currentDate);
// How will it work?
// using the last day of the month?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment