Write a program that prints Eligibility for casting vote using INPUT statement
Answers
Answer:
Program for eligibility for casting vote is as follows:
Explanation:
import java . util . *;
class sol2
{
public static void main(String args[])
{
Scanner sc=new Scanner(System . in);
System . out . println("Enter the Name of voter");
String name=sc . nextLine();
System . out . println("Enter the age of the voter");
int age=sc . nextInt();
System . out . println("Enter the Nationality of the voter");
String n=sc . nextLine();
if(n . equals("Indian")&&age>=18)
{
System . out . println("Yes "+ name +" is eligible for voting");
}
else
{
System . out . println("No "+name+" is not eligible for voting");
}
}
}