Package src

Class Person

java.lang.Object
src.Person
Direct Known Subclasses:
Customer

public class Person extends Object
Represents a person with personal details such as name, date of birth, address, and phone number.
  • 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

      public Person(String firstName, String lastName, String dob, String address, String phone)
      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

      public void setFirstName(String name)
      Sets the first name of the person.
      Parameters:
      name - The first name to set.
    • setLastName

      public void setLastName(String name)
      Sets the last name of the person.
      Parameters:
      name - The last name to set.
    • setDOB

      public void setDOB(String dob)
      Sets the date of birth of the person.
      Parameters:
      dob - The date of birth to set.
    • setAddress

      public void setAddress(String address)
      Sets the address of the person.
      Parameters:
      address - The address to set.
    • setPhoneNumber

      public void setPhoneNumber(String phone)
      Sets the phone number of the person.
      Parameters:
      phone - The phone number to set.
    • getFirstName

      public String getFirstName()
      Gets the first name of the person.
      Returns:
      The first name of the person.
    • getLastName

      public String getLastName()
      Gets the last name of the person.
      Returns:
      The last name of the person.
    • getDOB

      public String getDOB()
      Gets the date of birth of the person.
      Returns:
      The date of birth of the person.
    • getAddress

      public String getAddress()
      Gets the address of the person.
      Returns:
      The address of the person.
    • getPhoneNumber

      public String getPhoneNumber()
      Gets the phone number of the person.
      Returns:
      The phone number of the person.
    • getName

      public String getName()
      Gets the full name of the person by combining the first and last names.
      Returns:
      The full name of the person.
    • toString

      public String toString()
      Overrides:
      toString in class Object