-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerson.java
More file actions
96 lines (75 loc) · 2.28 KB
/
Person.java
File metadata and controls
96 lines (75 loc) · 2.28 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
90
91
92
93
94
95
96
package LMS;
public abstract class Person {
protected int id;
protected int dob;
protected String password;
protected String name;
protected String address;
protected int phoneNo;
public static int currID = 1; // current ID number. Increments by 1 on every new user
public Person(int id, String name, String address, int phone, int dob) { // Parameterized
// Constructor
if (id == -1) { // User doesn't have ID
this.id = currID;
currID++;
}
else { // User already has IDs
this.id = id;
}
this.password = Integer.toString(this.id) + Integer.toString(dob);
this.name = name;
this.address = address;
this.phoneNo = phone;
this.dob = dob;
}
public Person() {
;
}
public void printInfo() {
System.out.println("*********************************");
System.out.println("\nDetails Entered:");
System.out.println("ID: " + this.id);
System.out.println("Name: " + this.name);
System.out.println("Address: " + this.address);
System.out.println("Phone No: " + this.phoneNo);
// System.out.println("Password Generated.");
}
// Update Functions
public void updAddress(String address) {
this.address = address;
}
public void updPhone(int phone) {
this.phoneNo = phone;
}
public void updName(String name) {
this.name = name;
}
public void updPassword(String password) {
this.password = password;
}
public void updDob(int dob) { // this will NOT update password.
this.dob = dob;
}
// Get Functions
public String getName() {
return this.name;
}
public String getPassword() {
return this.password;
}
public String getAddress() {
return this.address;
}
public int getPhoneNumber() {
return this.phoneNo;
}
public int getDob() {
return this.dob;
}
public int getID() {
return this.id;
}
public static int getCurr() {
return currID;
}
}