Write a Java program to accept name and age from the user. If age is greater than or equal to 18 then display you can vote or else display you cannot vote. It should display it with user name.
IN JAVA ONLY!
Answers
Answered by
0
Answer:
public class Main
{
public static void main(String[] args) {
int age;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the year you want to check : ");
age = sc.nextInt();
//check voting eligibility
if (age>=18)
{
System.out.println("person is eligible for voting");
}
else
{
System.out.println("person is not eligibal for voting\n");
}
}
}
Explanation:
Similar questions
Math,
8 days ago
Math,
8 days ago
Math,
8 days ago
History,
16 days ago
Political Science,
9 months ago