-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerson.java
More file actions
53 lines (48 loc) · 1.07 KB
/
Person.java
File metadata and controls
53 lines (48 loc) · 1.07 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
/**
* The Person class is designed to represent simple people.
* @author Dani Dickstein
* @version 0.1
*/
public class Person {
private String name;
private String gender;
private int age;
/**
* Constructor for a person
* @param name This person's name
* @param gender This person's gender
* @param age This person's current age
*/
public Person(String name, String gender, int age) {
this.name = name;
this.gender = gender;
this.age = Math.max(age, 0);
}
/**
* Get the name of this person
* @return This person's name
*/
public String getName() {
return name;
}
/**
* Get the gender of this person
* @return This person's gender
*/
public String getGender() {
return gender;
}
/**
* Get the age of this person
* @return This person's age
*/
public String getAge() {
return age;
}
/**
* Increase the age of this person by 1 year
*/
public void increaseAge() {
age++;
}
}