Last active
December 12, 2015 10:39
-
-
Save danveloper/4760263 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 interface PaymentMethod { | |
enum PaymentMethodType { | |
GIFT_CARD, CREDIT_CARD | |
} | |
PaymentMethodType getType(); | |
} | |
public class GiftCard implements PaymentMethod { | |
String number; | |
BigDecimal balance; | |
@Override | |
public PaymentMethodType getType() { | |
return PaymentMethod.PaymentMethodType.GIFT_CARD; | |
} | |
} | |
public class CreditCard implements PaymentMethod { | |
String number; | |
Date expiration; | |
Address billingAddress; | |
@Override | |
public PaymentMethodType getType() { | |
return PaymentMethod.PaymentMethodType.CREDIT_CARD; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment