I need to prevent entry to a car park system during public holidays, but instead of making more classes i was hoping it could be done within my existing method. my question is, is there such thing in java that already has public holiday dates predefined and can be used within if state or some sort to prevent entry if todays date matches those list of public holiday dates.
this is my existing method.which as you can see checks if its weekend, saturday and sunday, both which are public day off. but in uk there are more days such as bank holidays, but how do i define all the rest of the dates.
public boolean checkHoliday(){
Calendar cal = Calendar.getInstance();
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
if (dayOfWeek == 1 || dayOfWeek == 7){
return true;
} else {
return false;
}
/*add method for further holiday date check*/
}