Enum Class DiscountType

java.lang.Object
java.lang.Enum<DiscountType>
challenge.lv2.DiscountType
All Implemented Interfaces:
Serializable, Comparable<DiscountType>, Constable

public enum DiscountType extends Enum<DiscountType>
다양한 할인 유형을 정의하는 열거형(enum) 클래스 각 할인 유형은 가격에 따라 다른 할인 정책을 적용합니다. 할인 유형:
  • Coupon - 10,000원 이상일 때 3,000원 할인
  • Cash - 10% 할인
  • General - 할인 없음
할인이 적용되는 함수인 discountPrice는 DiscountStructure를 구현했습니다. 각 할인 유형별로 다른 할인 방식이 적용되도록 람다식을 활용했습니다.
  • Enum Constant Details

  • Field Details

  • Constructor Details

  • Method Details

    • values

      public static DiscountType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static DiscountType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • discountPrice

      public int discountPrice(int price)