Question
can you please help me with these please package week_8.q1_blood_donor; /* The instructions are in grades/Lab 8 Questions.md */ /* * Main method to start
can you please help me with these please
package week_8.q1_blood_donor; /* The instructions are in grades/Lab 8 Questions.md */ /* * Main method to start the GUI. * Can do other non-gui-specific app setup here if needed. * For this lab, you probably don't need to modify this class. */ public class DonorProgram { public static void main(String[] args) { DonorGUI gui = new DonorGUI(); } }
ckage week_8.q1_blood_donor; import javax.swing.*; /** * See the Lab 8 Questions.md file for the instructions. * Don't forget to add screenshots of your program's GUI running. * Save the screenshots in the screenshots directory of this project. */ 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 mainPanel; DonorGUI() { setTitle("Blood Donor Eligibility"); setContentPane(mainPanel); pack(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setVisible(true); // TODO add a listener for your new checkEligibilityButton. // This should verify that the user has entered a positive double number // in both the weightTextField and ageTextField JTextField // If either or both are not valid (nothing entered, or not a number), // the resultLabel should display the INPUT_ERROR text. // If both weight and age are positive double 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 in resultLabel if they are eligible. // Display the NOT_ELIGIBLE text in resultLabel if they are not eligible. // Use the constants ELIGIBLE, NOT_ELIGIBLE, and INPUT_ERROR, provided in this file, // to display the text in resultLabel. } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started