18
3
Australians love public holidays, and drinking. Yesterday, the 26th January, was Australia day, which is a public holiday. I was glad to not be at work yesterday, and eager to know the next time I get a public holiday! Unfortunately, I had a bit too much to drink, and I'm not able to work it out for myself.
Write a program that will take a date in Australian date/time notation (dd/mm) as input, and output the amount of days until the next public holiday. Because I'm a Queensland (QLD) resident, I'm only interested in public holidays that affect Queenslanders:
25/03 | Good Friday
26/03 | Easter Saturday
28/03 | Easter Monday
25/04 | Anzac Day
02/05 | Labour Day
03/10 | Queen's Birthday
25/12 | Christmas Day
26/12 | Boxing Day
27/12 | Christmas Day holiday
Note the following from the site:
Christmas Day holiday
An additional public holiday to be added when New Year's Day, Christmas Day or Boxing Day falls on a weekend.
Because Christmas day is on Sunday, there is an extra public holiday. Christmas day is still a public holiday.
Because I'm a morning person, you should include the current date as a day (as that's the most likely time I will check your program for the next public holiday). That is, if a public holiday's date is entered, your output should be 0
; if the day before a public holiday is entered, your output will be 1
.
I'm only interested in dates between now (the 27/01) until the end of the year. The final date you will need to account for is 31/12 where your output will be 1
(for New Year's day).
Standard loopholes are forbidden.
Input
- Input will always be 5 characters: 4 letters, separated with a hyphen
-
or slash/
- Input will only be a date between 27/01 and 31/12
Output
- The number of days until the next public holiday in Queensland Australia, inclusive of the input date: should be a number between
0
and153
(the longest gap) - No new lines or errors
Examples
01-05 = 1
02-05 = 0
03-05 = 153
25/12 = 0
26-12 = 0
27/12 = 0
30/12 = 2
31-12 = 1
Hopefully this is clear and nothing is missed; however, this is my second question so I will appreciate any feedback and do my best to fix problems ASAP.
@insertusernamehere Thanks for the great suggestion! I've added the dates in to the question – Tas – 2016-01-26T21:56:59.120
@Tas are you sure those dates are correct? The ones in the examples don't match the quote and both of them don't match the website. – Adam Martin – 2016-01-26T22:47:33.730
@AdamMartin Thanks for pointing that out. I had incorrectly put in the December dates. The ones in the example are just any dates, not specific to public holidays. They are just examples of dates that could be entered, and what the output should be. The quoted ones should (and hopefully do) match the ones from the website. – Tas – 2016-01-26T22:50:05.193
You celebrate the Queen's birthday in October in Queensland? That is so weird, but seems correct from the link. – Level River St – 2016-01-26T22:52:44.227
Wow, you guys don't have any holidays from June straight through September? That's rough. – Joe Z. – 2016-01-27T19:21:03.097
@Tas Based on the chat in the comments in [this answer] (http://codegolf.stackexchange.com/a/70294/49110) you probably should clarify the seperator-topic in your question. It is not clear if we have to deal with both possible seperators or just one.
– Denker – 2016-02-01T12:37:45.857