Program to check the age of user
import javax.swing.JOptionPane;
public class Vote_eligible {
public static void main(String[] args)
{
int iAge=Integer.parseInt(JOptionPane.showInputDialog("enter age"));
if (iAge>= 18)
{
JOptionPane.showMessageDialog(null, "Voter is above or equal to 18 years ,Elibible to vote");
}
else
{
JOptionPane.showMessageDialog(null, "Voter not eligible to vote");
}
}
}
No comments:
Post a Comment