Created
October 25, 2017 15:53
-
-
Save claraj/a783e1ab6a392f870db91693aedcea37 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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