OOP
-
오브젝트 2 - 유연한 객체 협력 모델 만들기책책책 책을 읽읍시다/프로그래밍 2023. 2. 8. 22:58
이번 예제는 영화 예매 시스템이다. 영화를 상영하는 스크린이 있고, 영화 상영 요금에 대한 할인 정책과 할인 조건이 있다. 할인 정책은 금액(예: 1000원)과 비율(예: 5%)이 있고, 한 영화에 하나만 적용 가능하다. 할인 조건은 순번(예: 조조 첫타임 할인)과 기간(예: 월요일 10:00~12:00 할인)이 있는데 정책과 달리 복수개가 적용 가능하다. 아래는 각 객체들에 대한 설명이다. Screening : 영화 상영 정보에 따라 상영 회차별 예매 금액을 표시한다. Reservation : 영화 상영 회차별 예약을 담당한다. Movie : Screen의 요청을 받아 영화별 할인 정책에 따른 예매 금액을 계산한다. 영화별로 할인 정책을 정할 수 있다. DiscountPolicy : 할인 정책으로 아래..