Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

// java public class DonorGUI extends JFrame { public static final String ELIGIBLE = Eligible! ; public static final String NOT_ELIGIBLE = Sorry, not eligible.

// java public class DonorGUI extends JFrame { public static final String ELIGIBLE = "Eligible!"; public static final String NOT_ELIGIBLE = "Sorry, not eligible."; public static final String INPUT_ERROR = "Error - enter positive numbers"; private JPanel rootPanel; private JButton checkEligibilityButton; private JTextField weightTextField; private JTextField ageTextField; private JLabel resultLabel; DonorGUI() { this.setContentPane(rootPanel); pack(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setVisible(true); // TODO add a listener for the checkEligibilityButton  // This should verify that the user has entered a positive number  // in both the weightTextField and ageTextField JTextField  // If either or both are not valid, the resultLable should  // display the INPUT_ERROR text.   // If both weight and age are positive numbers, use the data  // to decide if the user is eligible to be a blood donor.  // To be eligible, a person must be 17 or older,  // AND weigh 110 lbs or more.   // Display the ELIGIBLE text if they are eligible.  // Display the NOT_ELIGIBLE text if they are not eligible.   } } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Development For Dummies

Authors: Allen G. Taylor

1st Edition

978-0764507526

More Books

Students also viewed these Databases questions