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("
");
}