Have you bought lift tickets at a ski resort lately? There are a lot of options. Different age groups, different days (week days, weekends, holidays) and different options for how long you will be skiing or which hills you will be on. I can’t imagine any of this working without computer terminals. Well not without having smart people taking time that you don’t want them to take. So obviously this is a good programming project.
I’m working with decision structures with my programming students. I was trying to think of something new to do. Something that would involve if statements with a little complexity and that might I thought of lift tickets. Off I went to the website of a ski resort I have enjoyed (Bretton Woods in NH) and took a snapshot of their rates. The whole thing is more complicated than I wanted for now so I just recorded the weekend rates for full-day, the various age groups and the different prices for resort guests and non-guests. I asked the students to put together a program to ask for an age, resort stay status, and show the price for a single ticket.
There are four age ranges not including younger than 5 and older than 79 which are groups that ski/ride for free. Having the two options for each age group almost forces nested if statements. Almost but not quite.
The thing I may like most about this project is that there are many possible ways to solve it. So far I seem to have almost as many different solutions as I have students. Even better – not all of them work in all cases. Our next class is going to involve looking at different solutions and discussing them.
It should make for an interesting class.