奈學(xué)Kubernetes 企業(yè)級(jí)應(yīng)用之日志管理
class Discount95Strategy extends DiscountStrategy {
? ?@Override
? ?public int discount(int price, User user) {
? ? ? ?return (int) (price * 0.95);
? ?}}class VipDiscountStrategy extends DiscountStrategy {
? ?@Override
? ?public int discount(int price, User user) {
? ? ? ?if (user.isVip()) {
? ? ? ? ? ?return (int) (price * 0.85);
? ? ? ?}
? ? ? ?return (int) (price * 0.95);
? ?}
標(biāo)簽: