-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerson.java
More file actions
89 lines (71 loc) · 1.8 KB
/
Person.java
File metadata and controls
89 lines (71 loc) · 1.8 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
public abstract class Person {
private String FirstName;
private String LastName;
private int Id;
private int Age;
private Date BirthDate;
private char Gender;
//constructor
public Person(String FirstName, String LastName, int Id, int Age, Date BirthDate, char Gender) {
this.FirstName = FirstName;
this.LastName = LastName;
this.Id = Id;
this.Age = Age;
this.BirthDate = BirthDate;
this.Gender = Gender;
}
public Person() {
this(" ", " ", 0, 0, null, ' ');
}
//getters
public String getFirstName() {
return FirstName;
}
public String getLastName() {
return LastName;
}
public int getId() {
return Id;
}
public int getAge() {
return Age;
}
public Date getBirthDate() {
return BirthDate;
}
public char getGender() {
return Gender;
}
//setters
public void setFirstName(String FirstName) {
this.FirstName = FirstName;
}
public void setLastName(String LastName) {
this.LastName = LastName;
}
public void setId(int Id) {
this.Id = Id;
}
public void setAge(int Age) {
this.Age = Age;
}
public void setBirthDate(Date BirthDate) {
this.BirthDate = BirthDate;
}
public void setMobileNum(char Gender) {
this.Gender = Gender;
}
@Override
public String toString() {
return String.format("First Name:%s \nLast Name:%s \nId: %d \nAge: %d \n%sGender:%s %n",
FirstName, LastName, Id, Age, BirthDate.toString(), Gender);
}
public abstract void NameOfClass();
public String checkAge() {
if (Age > 18) {
return "Adult";
} else {
return "Child";
}
}
}