i m making a BMI calculator GUI which calcuates weight in corresponding to height shown on slider but there is some error in program. problem lies in following line

int value = slider.getValue();
        int weight=0;
	if (if buttonGroup.getSelected()=="Male")
	else if (buttonGroup.getSelected()==Female)

The compiler error message tells you exactly what the error is and exactly which line it's on. "some error in program" is useless as a problem description.

In line 3 you have if(if "condition". Don't think there should be two ifs there.

You should not be testing a button group either. It is just something that can group radio buttons, checkboxes, etc... together. Test the individual checkbox/radiobutton(whatever you have) instead of the button group.

Try something like:


(this is assuming you are using checkboxes for your options)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.