You are currently assigning the value M
to SystemOfMeasure
, but if
or else if
conditions expect a boolean
expression, NOT an assignment.
So, you need to use .equals()
method (which returns true
/false
) for string comparisons like SystemOfMeasure.equals("M")
as shown below:
if (SystemOfMeasure.equals("M")) {
//add your code
} else if (SystemOfMeasure.equals("I") {
//add your code
} else {
//add your code
}
Also, remember that, you need to follow the java naming standards like lower case for variable names like systemOfMeasure