-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>taejung_</groupId> | ||
<artifactId>assignment2</artifactId> | ||
<version>1.0</version> | ||
<packaging>jar</packaging> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>8</source> | ||
<target>8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package taejung.movie; | ||
|
||
import taejung.money.Money; | ||
|
||
|
||
public class Audience { | ||
|
||
private AudienceType audienceType; | ||
private int audienceCount; | ||
|
||
public Audience(AudienceType audienceType, Money fee, int audienceCount) { | ||
this.audienceType = audienceType; | ||
this.audienceCount = audienceCount; | ||
} | ||
|
||
public AudienceType getAudienceType() { | ||
return audienceType; | ||
} | ||
|
||
public int getAudienceCount() { | ||
return audienceCount; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package taejung.movie; | ||
|
||
public enum AudienceType { | ||
ADULT("성인"), | ||
TEENS("청소년"), | ||
CHILDREN("어린이"); | ||
|
||
final String name; | ||
|
||
AudienceType(String name) { | ||
this.name = name; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return name; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package taejung.movie; | ||
|
||
import taejung.money.Money; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public abstract class DefaultRefundPolicy implements RefundPolicy { | ||
private List<RefundCondition> conditions = new ArrayList<>(); | ||
|
||
public DefaultRefundPolicy(RefundCondition... conditions) { | ||
this.conditions = Arrays.asList(conditions); | ||
} | ||
|
||
@Override | ||
public Money calculateRefundAmount(Screening screening) { | ||
for(RefundCondition each : conditions) { | ||
if (each.isRefundable(screening)) { | ||
return getRefundAmount(screening); | ||
} | ||
} | ||
|
||
return Money.ZERO; | ||
} | ||
|
||
abstract protected Money getRefundAmount(Screening Screening); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package taejung.movie; | ||
|
||
public interface RefundCondition { | ||
boolean isRefundable(Screening screening); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package taejung.movie; | ||
|
||
import taejung.money.Money; | ||
|
||
public interface RefundPolicy { | ||
Money calculateRefundAmount(Screening screening); | ||
} |