I wanna find out the date of penance and prayer.
The penance and prayer has a special rule.
Always a Wednesday and 4 Sundays before Christmas. The first Christmas is at 24.12.
I set the month at 12. The for-loop start at day=24 and its decrease every time. I have a problem that its not go to the month 11 and start from that length.
weekdayInYear => give me (0 = Sunday and 3 = Wednesday)
The if-Statement if (weekdayInYear==3) get never true. I know why it gets never true but I dont know how to fix it.
multiplicator is for the repeat time amount.
this.holidayMap.put is a HashMap with String and Event. Event takes a String name of the holidayname.
int month = 12;
for (int day = 24; day<= getLengthOfMonth(year, month); day--) {
int daynumber = calenderFunction.daynumber(day, month, year);
int weekdayInYear = getWeekDayInYear(year, daynumber);
multiplicator = 0;
if (weekdayInYear == 0) {
multiplicator++;
if (multiplicator == 4) {
if (weekdayInYear == 3) {
this.holidayMap.put(getTwoLetter(day)+"."+getTwoLetter(month),new Event("penance and prayer"));
}
}
}
}
Sadly, i cant use the Calender class of Java.
Best regards Gordon
Aucun commentaire:
Enregistrer un commentaire