-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerson.java
More file actions
executable file
·29 lines (24 loc) · 823 Bytes
/
Copy pathPerson.java
File metadata and controls
executable file
·29 lines (24 loc) · 823 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
/*
File Name: Person.java
Description: The following program is the Person class that builds the foundation for the other(Student and Teacher) classes.
*/
//This is the declaration of the class.
public class Person {
//These are the declarations of the fields.
protected Name name;
//This is the constructor for the class.
//It takes in a String and creates a partial Person object.
public Person (String fullName){
name = new Name (fullName);
}
//This is the mutator of the class.
//It takes in a Name object and returns no value.
public void setName (Name newName){
name = newName;
}
//This is the accessor of the class.
//It takes in no parameters and returns a Name object.
public Name getName(){
return name;
}
}