mardi 6 juin 2017

How to determine Motherday?

The rule of motherday is that the second sunday of May is motherday. But if motherday cut whitSunday then the motherday should brought forward 1 week. I use the multiplicator for 0 (Sunday). I get from my HashMap a duplicate of Motherday so I think that I have a bug in my algorithm.

if (weekdayInYear == 0)/*0 is for sunday*/ {
                    multiplicator++;
                    if (multiplicator == 2) {
                        if (this.holidayMap.containsValue("whitSunday")) {
                            multiplicator++;
                            if (multiplicator == 3) {
                                this.holidayMap.put(getTwoLetter(day) + ".05", new Event("Motherday"));
                            }
                        } else if (!this.holidayMap.containsValue("whitSunday")){
                            this.holidayMap.put(getTwoLetter(day) + ".05", new Event("Motherday"));
                        }

                    }
                }

I hope you can help me and pls dont answer with the library of Java "Calender", I cant use it.

Best Regards Michael

Aucun commentaire:

Enregistrer un commentaire