The exercise Movie Tickets is unclear

22 views
Skip to first unread message

tetha

unread,
Sep 5, 2010, 2:26:50 AM9/5/10
to coding kata
Greetings,

it appears that the test suite of the Movie Tickts exercise is lacking
some interesting edge cases.

For example, think of 19 students and 2 children. In this case, the
lowest average price is achieved if we ticket one groupe of 20 persons
(19 students + 1 child) and 1 child (because this lowers the price for
19 peoples from $8 to $6 and raises the price from $5.50 to $6 only).

Second, for a group of 20 or more old people, it actually is better to
not apply the group price on thursdays, because this will enable them
the movie day discount, lowering the average ticket price.

There are some solutions which can solve the second case, however,
from what I have seen in the java solutions, no solution appears to be
able to handle the first case.

I think a fix would be to either state that "A single purchase must
either be a ticket in its entirety or be not handled as a group at
all", or change the test cases (which will invalidate many solutions
and make the problem quite a bit harder :)

Regards,
Tetha.

stephanos

unread,
Sep 5, 2010, 10:41:03 AM9/5/10
to coding kata
Those are indeed some very interesting cases you propose! I didn't
think about those before.
I might consider those in case I do a part 2 of the exercise (harder
one),
because as you mention changing the 'specification' now would
invalidate many solutions or create confusion.

But thanks for you interesting considerations. If I could I would give
you a bonus belt ^^
Reply all
Reply to author
Forward
0 new messages