-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEligibility.java
More file actions
28 lines (21 loc) · 762 Bytes
/
Eligibility.java
File metadata and controls
28 lines (21 loc) · 762 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//Write a function that takes in age as input and returns if that
//person is eligible to vote or not. A person of age > 18 is eligible to vote.
package Function;
import java.util.Scanner;
public class Eligibility {
public static boolean isEligibility(int age){
if(age >= 18){
System.out.print("The person is eligible : "+" ");
return true;
} else {
System.out.print("The person is not eligible : "+" ");
return false;
}
}
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
int age = sc.nextInt();
// System.out.print("The circumference of a circle is:" +" ");
System.out.println(isEligibility(age));
}
}