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 */

[1388 byte] By [lyriclovera] at [2007-10-2 19:49:29]
# 1
Show us where you think 'propertyCode' is being changed in that loop. Do you think it is somehow magically related to the 'propertyCodeString' variable which is being changed according to what the user enters?
warnerjaa at 2007-7-13 22:28:22 > top of Java-index,Java Essentials,New To Java...
# 2
The following line seems to be missing in your code.. char propertyCode = propertyCodeString.charAt(0);
ordinary_guya at 2007-7-13 22:28:22 > top of Java-index,Java Essentials,New To Java...
# 3
Worked great! Thanks a bunch!
lyriclovera at 2007-7-13 22:28:22 > top of Java-index,Java Essentials,New To Java...