char troubles :S
Hello, I'm new to Java. I've got the following code, and it seems that I'm stuck in the loop. Even if I enter a "valid" propertyCode, it returns my invalid error text and requests the propertyCode again (which is what I want to happen, but only if an invalid propertyCode is entered). I believe the problem is that the prompt is not recognizing the values entered against the values specified in my switch statement. FYI, I have no compile errors.
Suggestions?
/** beginning of loop */
do
{
String propertyCodeString = JOptionPane.showInputDialog(null,
"Enter the property code (R, M and C only):",
"Suze 05/09/06 - Assignment 2-1 Input", JOptionPane.QUESTION_MESSAGE);
switch (propertyCode)
{
case 'R' : commissionRate = 7.0;
break;
case 'r' : commissionRate = 7.0;
break;
case 'M' : commissionRate = 6.0;
break;
case 'm' : commissionRate = 6.0;
break;
case 'C' : commissionRate = 3.5;
break;
case 'c' : commissionRate = 3.5;
break;
default: System.out.println("Invalid property Code.");
}
} while(propertyCode != 'R' && propertyCode != 'r' && propertyCode != 'M' && propertyCode != 'm' && propertyCode != 'C' && propertyCode != 'c');
/** End of loop */

