I'm a beginner with java and I can't seem to figure out why string won't convert to boolean.
The error code comes up specifically on the "if" line and "else if" line.
String Name, SystemOfMeasure;
Double Height, IdealWeight;
// Retrieve user data
Name = txtName.getText();
SystemOfMeasure = txtSystemOfMeasure.getText();
Height = Double.parseDouble(txtHeight.getText());
if (SystemOfMeasure = "M") {
IdealWeight = Height * Height * 25;
lblDisplay.setText(Name + ("'s ideal weight is") + IdealWeight);
} else if (SystemOfMeasure = "I") {
IdealWeight = Height * Height * 25 / 703;
lblDisplay.setText(Name + ("'s ideal weight is") + IdealWeight);
} else {
lblDisplay.setText("Please enter M or I");
}