In the previous module, we introduced the concept of object-oriented programming and presented a new type of problem suitable to solve with this approach. This module aims to present a complete picture on using Java for object-oriented programming by practice on the exercise of designing a Phone book directory. Through a set of short and concise presentations, we will introduce the concept of the class, object (state, behavior and identity), and abstraction, and define the correct syntax and provided functionalities in Java that we can use to implement classes and objects of different types and applications.
Designing classes
Constructors
Setters and Getters
Static properties and methods
Comparison
Textual representation of objects
Code for the Phone Book application
Here is the complete implementation of the Person class.

Using this implementation, we can implement a PhoneBook class that has the phone book storage and management functionalities. The main method of the class will implement the main user interface.

Each time the user wants to add a new person in the contacts, the add method is called to create a new Person object with the desired information and stored in the contacts list.

If the user instead wants to retrieve the contact information of a given person’s first and last name, we can invoke the find method, which will search for the person in the contacts, and display the desired information. If the person is not found, it should display an error message.

We can also remove a person from the contacts using the remove method. The search method over the contacts list remains the same, where instead of only reading the information we now set this entire element in the array to null. After we remove the person from contacts, we also decrement the number of contacts defined in the Person class.

Please inspect the example implementation and attempt to develop your own solution to the phone book application.