15. The system for selling cinema tickets calculates the discount type based on the client’s birth year (BY) and on the current year (CY) as follows:
Let D be the difference between CY and BY, that is, D = CY – BY
• If D < 0 then print the error message “birth year cannot be greater than current year”
• If 0 ≤ D < 18 then apply the student discount
• If 18 ≤ D < 65 then apply no discount
• If D ≥ 65 then apply the pensioner discount
Your test suite already contains two test cases:
• BY = 1990, CY = 2020, expected result: no discount
• BY = 2030, CY = 2029, expected result: print the error message
Which of the following test data sets should be added to achieve full valid equivalence partitioning coverage for the discount type?
Explanation / Rationale
There are two equivalence partitions that are not yet covered, which correspond to “student discount” and “pensioner discount”.
a) Is not correct. CY – BY = 64, so these inputs correspond to the already covered “no discount” partition
b) Is correct. CY – BY = 65, so these inputs correspond to a partition that is not yet covered (“pensioner discount”)
c) Is not correct. CY – BY = –65, so these inputs correspond to the already covered “error message” partition
d) Is not correct. CY – BY = 18, so these inputs correspond to the already covered “no discount” partition
e) Is correct. CY – BY = 0, so these inputs correspond to a partition that is not yet covered (“student discount”)