Java Reference
In-Depth Information
Instance Variables:
private
Person name;
private
Date bDay;
private int
personID;
Constructors and Instance Methods:
public void
setPersonalInfo(String first, String last,
int
month,
int
day,
int
year,
int
ID)
//Method to set the personal information
//Instance variables are set according to the parameters
//Postcondition: firstName = first; lastName = last;
//
dMonth = month; dDay = day; dYear = year;
//
personID = ID;
public
String toString()
//Method to return the string containing personal information
public
PersonalInfo(String first, String last,
int
month,
int
day,
int
year,
int
ID)
//Constructor with parameters
//Instance variables are set according to the parameters
//Postcondition: firstName = first; lastName = last;
//
dMonth = month; dDay = day; dYear = year;
//
personID = ID;
public
PersonalInfo()
//Default constructor
//Instance variables are set to the default values
//Postcondition: firstName = ""; lastName = "";
// dMonth = 1; dDay = 1; dYear = 1900;
// personID = 0;
Figure 10-17 shows the UML class diagram of the
class
PersonalInfo
.
1
0
PersonalInfo
-name: Person
-bDay: Date
-personID:
int
+PersonalInfo()
+PersonalInfo(String, String,
int
,
int
,
int
,
int
)
+setPersonalInfo(String, String,
int
,
int
,
int
,
int
):
void
+toString(): String
PersonalInfo
Person
Date
FIGURE 10-17
UML class diagram of the
class
PersonalInfo
Search WWH ::
Custom Search