-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy patheligibility.java
More file actions
38 lines (31 loc) · 785 Bytes
/
eligibility.java
File metadata and controls
38 lines (31 loc) · 785 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
29
30
31
32
33
34
35
36
37
38
import java.util.Scanner;
public class eligibility {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
int cases = scan.nextInt();
for (int zaxby = 0; zaxby < cases; zaxby++)
{
String name = scan.next();
String STU = scan.next();
String DOB = scan.next();
int courses = scan.nextInt();
int eligibility = 0;
if (Integer.parseInt(STU.substring(0,4)) >= 2010)
eligibility = 1;
else if (Integer.parseInt(DOB.substring(0,4)) >= 1991)
eligibility = 1;
else if (courses > 40)
eligibility = 0;
else
eligibility = 2;
System.out.print(name + " ");
if (eligibility == 0)
System.out.println("ineligible");
else if (eligibility == 1)
System.out.println("eligible");
else
System.out.println("coach petitions");
}
scan.close();
}
}