I am very new to Java-programming, and have some problems in getting an enumerated type to work. In my program I have declared the following static variables:
class Employee {
enum Gender {MALE, FEMALE};
static final double NORMAL_WORK_WEEK = 37.5;
static int numberOfFemales;
static int numberOfMales;
Gender sex;
}
I have added a method for printing relevant information, as well as the following method:
static void registerEmployeeGender(Gender sex) {
switch(sex) {
case MALE:
numberOfMales++; break;
case FEMALE:
numberOfFemales++; break;}
}
In my client where I attemt to run the program, I am unable to use this last method. Say I create an object, Employee1, and type:
Employee1.registerEmployeeGender(FEMALE);
I then get the error message: FEMALE cannot be resolved to a variable.
What is causing this error message? Like I said, I am quite new to Java, and this is my first attempt at using the enumerated type, so I probably have done something wrong. If anyone can give me any help, I would greatly appreciate it.
Of course, I have only posted part of the program here, but this is the only part that is giving me an error message. If you need me to post more of the program, or all of it for that matter, please let me know.
Thanks in advance for any help!