Please tell me that I wasn't the only one who could not wrap my head around this question.
I just could not understand how to apply the visitor pattern to the rate calculation for a booking...
Strategy Pattern maybe, but not the visitor pattern.
Just tell yourself it went OK. Might as well. You can't fix it now. Me? I'm telling myself I klapped it. For a month I'll be happy as can be.
If you managed the others you'll be fine. It wasn't EASY. This course just never goes there. However it was about 100 000 000 times easiER than last year's. I'd say this time they at least provided a passable paper.
Excellent paper. Well done to the Lecturer - this time around with the Videos created, paper being similar to Oct/Nov 2011 - we should pass if we studied well. Once again between work, home and my exams - my time management skills was a failure hence I must have failed again - entirely my fault this time. Best of luck for those of you that deserve to pass this course. I am done now - too old and tired of failing this course...
I didn't have any problems with the visitor pattern.. Just look at this diagram.. the Booking is the Element (in the diagram) and Single/Double are concreteElements(in the diagram)
Just abstract the Visitor and make subclasses for each of the different rates. In each Visitor subclass you just
A giveaway was that the SINGLEBPMMM and DOUBLEBPMMM were private. So we can change them in the derived classes.
and in the Booking base class (which I figured out in the exam that you only need it in the base class) you just