Last active
April 4, 2024 01:18
-
-
Save mcsee/9816f1ef8c6e05ceb9f750113471e03f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CreditCard { | |
private String cardNumber; | |
private int expiryMonth; | |
private int expiryYear; | |
public CreditCard(String cardNumber, int expiryMonth, int expiryYear) { | |
this.cardNumber = cardNumber; | |
this.expiryMonth = expiryMonth; | |
this.expiryYear = expiryYear; | |
// No validations on number ranges? | |
} | |
public boolean isExpired(int currentMonth, int currentYear) { | |
return (expiryYear < currentYear) || | |
(expiryYear == currentYear && expiryMonth < currentMonth); | |
} | |
// Inappropriate intimacy code smell | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment