-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit c1d573f.
- Loading branch information
Showing
4 changed files
with
21 additions
and
22 deletions.
There are no files selected for viewing
7 changes: 1 addition & 6 deletions
7
src/main/java/com/github/hcsp/polymorphism/Discount95Strategy.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
package com.github.hcsp.polymorphism; | ||
|
||
public class Discount95Strategy extends DiscountStrategy{ | ||
@Override | ||
public int discount(int price, User user) { | ||
return (int)(price * 0.95); | ||
} | ||
} | ||
public class Discount95Strategy {} |
7 changes: 1 addition & 6 deletions
7
src/main/java/com/github/hcsp/polymorphism/NoDiscountStrategy.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
package com.github.hcsp.polymorphism; | ||
|
||
public class NoDiscountStrategy extends DiscountStrategy{ | ||
@Override | ||
public int discount(int price, User user) { | ||
return price; | ||
} | ||
} | ||
public class NoDiscountStrategy {} |
7 changes: 1 addition & 6 deletions
7
src/main/java/com/github/hcsp/polymorphism/OnlyVipDiscountStrategy.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
package com.github.hcsp.polymorphism; | ||
|
||
public class OnlyVipDiscountStrategy extends DiscountStrategy{ | ||
@Override | ||
public int discount(int price, User user) { | ||
return user.isVip() ? (int) (price * 0.95) : price; | ||
} | ||
} | ||
public class OnlyVipDiscountStrategy {} |
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