-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpassport.java
56 lines (31 loc) · 963 Bytes
/
passport.java
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import java.util.Scanner;
public class passport {
boolean passportinfo(int age, String name) {
boolean check;
if(age>=18) {
check = true;
}else {
check = false;
}
System.out.println("Name: " + name);
if(check==true) {
System.out.println("You are eligible for passport");
}else {
System.out.println("You are NOT eligible for passport");
}
return check;
}
public static void main(String args[])
{
passport ob = new passport();
Scanner hi = new Scanner(System.in);
String pholder;
System.out.print("Enter your name: ");
pholder = hi.nextLine();
System.out.print("Enter your age for passport: ");
int aging = hi.nextInt();
//boolean checkup = ob.passport(aging) ;
//then you must omit ob.passport(aging) from if and add only "check==true"
System.out.println(ob.passportinfo(aging, pholder));
}
}