Package src
Class Person
java.lang.Object
src.Person
- Direct Known Subclasses:
Customer
Represents a person with personal details such as name, date of birth,
address, and phone number.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the address of the person.getDOB()Gets the date of birth of the person.Gets the first name of the person.Gets the last name of the person.getName()Gets the full name of the person by combining the first and last names.Gets the phone number of the person.voidsetAddress(String address) Sets the address of the person.voidSets the date of birth of the person.voidsetFirstName(String name) Sets the first name of the person.voidsetLastName(String name) Sets the last name of the person.voidsetPhoneNumber(String phone) Sets the phone number of the person.toString()
-
Constructor Details
-
Person
public Person()Constructs a Person object with default values. The default values for firstName, lastName, dob, address, and phone are set to empty strings. -
Person
Constructs a Person object with specified values for each attribute.- Parameters:
firstName- The first name of the person.lastName- The last name of the person.dob- The date of birth of the person.address- The address of the person.phone- The phone number of the person.
-
-
Method Details
-
setFirstName
Sets the first name of the person.- Parameters:
name- The first name to set.
-
setLastName
Sets the last name of the person.- Parameters:
name- The last name to set.
-
setDOB
Sets the date of birth of the person.- Parameters:
dob- The date of birth to set.
-
setAddress
Sets the address of the person.- Parameters:
address- The address to set.
-
setPhoneNumber
Sets the phone number of the person.- Parameters:
phone- The phone number to set.
-
getFirstName
Gets the first name of the person.- Returns:
- The first name of the person.
-
getLastName
Gets the last name of the person.- Returns:
- The last name of the person.
-
getDOB
Gets the date of birth of the person.- Returns:
- The date of birth of the person.
-
getAddress
Gets the address of the person.- Returns:
- The address of the person.
-
getPhoneNumber
Gets the phone number of the person.- Returns:
- The phone number of the person.
-
getName
Gets the full name of the person by combining the first and last names.- Returns:
- The full name of the person.
-
toString
-