-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
22 additions
and
26 deletions.
There are no files selected for viewing
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,4 +1,17 @@ | ||
package study.book.object.movie; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@Getter @Setter | ||
@ToString | ||
public class Customer { | ||
private String name; | ||
private String id; | ||
|
||
public Customer(String name, String id) { | ||
this.name = name; | ||
this.id = id; | ||
} | ||
} |
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
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,35 +1,15 @@ | ||
package study.book.object.movie; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
@Getter @Setter | ||
@ToString | ||
public class Screening { | ||
private Movie movie; | ||
private int sequece; | ||
private LocalDateTime whenScreened; | ||
|
||
public Screening(Movie movie, int sequence, LocalDateTime whenScreened) { | ||
this.movie = movie; | ||
this.sequece = sequence; | ||
this.whenScreened = whenScreened; | ||
} | ||
|
||
public Reservation reserve(Customer customer, int audienceCount) { | ||
return new Reservation(customer, this, calculateFee(audienceCount), audienceCount); | ||
} | ||
|
||
public LocalDateTime getStartTime() { | ||
return whenScreened; | ||
} | ||
|
||
public boolean isSequence(int sequence) { | ||
return this.sequece == sequece; | ||
} | ||
|
||
public Money getMovieFee() { | ||
return movie.getFee(); | ||
} | ||
|
||
private Money calculateFee(int audienceCount) { | ||
return movie.calculateMovieFee(this); | ||
} | ||
} |