I'm working on code that will change the date to tomorrow, in the Russian calendar.
if I put in an "else" before the start of the "if" block of code (commented PROBLEM IS HERE right above it), it will connect that block to the ones above it (code specific to Russia); however, that makes regular dates in the Russian calendar not work. So, Dec 31, 1710 won't be able to be changed. Not using "else" means that both blocks will run, which I don't want. How can I use the "else" statement so that it will work?
The "problem bit" works in other areas of my code, so I don't know why the code here doesn't run all the way down to this area.
if(location.equals("Russia")){
if(day == 31){
if(month == 1) {
if(year == 1918){
setDay(14);
setMonth("February");
}
}
} else if(day == 28){
if(month == 2){
if(year < 1492){
setDay(1);
setMonth("March");
setYear(year+1);
}
}
} else if(day == 31){
if(month == 8){
if (year >= 1492){
if(year < 1700){
setDay(1);
setMonth("September");
setYear(year+1);
}
}
}
}
//PROBLEM IS HERE
else if(day+1 <= daysInMonth() && month != 12){
setDay(day+1);
} else if(month == 12 && day+1 > daysInMonth()){
setDay(1);
setMonth("January");
setYear(year+1);
} else {
setDay(1);
month += 1;
}
}
Aucun commentaire:
Enregistrer un commentaire