I'm doing a problem to find a day of the week with Zeller's algorithm.
I have to convert 1 to 13 and 2 to 14. However I receive an error of duplicating local variable. The book shows changing variables with temp variable but it does not work on Eclipse. It shows an error. Here's an example:
System.out.println("Enter a month 1-12: ");
int m = input.nextInt();
// Convert January to 13 and February to 14; Zeller's requirement
if (m == 1){
int temp = 13;
int m = temp;
}
else if (m == 2){
int temp = 14;
int m = temp;
}
}
I just started introductory book on Java and maybe there is simple solution here?