Skip to content

Instantly share code, notes, and snippets.

@claraj
Created October 25, 2017 15:53
Show Gist options
  • Save claraj/a783e1ab6a392f870db91693aedcea37 to your computer and use it in GitHub Desktop.
Save claraj/a783e1ab6a392f870db91693aedcea37 to your computer and use it in GitHub Desktop.
double age;
double weight;
try {
age = Double.parseDouble(ageTextFeild.getText());
weight = Double.parseDouble(weightTextFeild.getText());
}
catch (NumberFormatException e) {
age = -1;
weight =-1;
}
if (age < 0 && weight < 0) {
resultLabel.setText(INPUT_ERROR);
}
else if (age >= 17 && weight >= 100) {
resultLabel.setText(ELIGIBLE);
}
else {
resultLabel.setText(NOT_ELIGIBLE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment