Thursday, May 9, 2013

Netbeans Lesson 5


Q4. To find eligibility for vote.



    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
int age;
String txt = txta.getText();
age = Integer.parseInt(txt);
if(age>=18)
    txtm.setText("YOU ARE ELIGIBLE VOTER");
else
    txtm.setText("YOU ARE NOT ELIGIBLE FOR VOTING");
    }

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
    }

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
txtm.setText(" ");
txta.setText(" ");

    }


No comments:

Post a Comment

  A Potential Showdown: Kamala Harris vs. Donald Trump As the political landscape gears up for the next election cycle, the prospect of a fa...