-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerson.java
More file actions
50 lines (40 loc) · 846 Bytes
/
Copy pathPerson.java
File metadata and controls
50 lines (40 loc) · 846 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
39
40
41
42
43
44
45
46
47
48
49
import java.time.*;
public class Person
{
protected String firstName;
protected String lastName;
private LocalDate birthday;
public Person()
{
this.firstName = null;
this.lastName = null;
birthday = null;
System.out.println("Default Person Constructor");
}
public Person(String fName, String lName)
{
this.firstName = fName;
this.lastName = lName;
birthday = LocalDate.now();
}
public void greeting()
{
System.out.println("Hello, my name is "+this.firstName+".\n\tI am a person.");
}
public String toString()
{
return "PERSON: "+getName()+" "+getBirthday();
}
public void setBirthday(int year, int month, int day)
{
this.birthday = LocalDate.of(year, month, day);
}
public String getName()
{
return firstName+" "+lastName;
}
public String getBirthday()
{
return birthday.toString();
}
}