Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Java Programming: Create a class called Contact that has a firstName, lastName,

ID: 3690374 • Letter: J

Question

Java Programming:

Create a class called Contact that has a firstName, lastName, phone and email. Also create a PhoneBook class that will have an arrayList of contact The PhoneBook class will have the following methods: addContact that takes a Contact object and adds is to the arrayList deleteContact that takes a Contact object and deletes it from the arrayList displayContacts that displays all contacts in the arrayList getSize that returns the number of contacts in the arrayList main method to run and test your program.

Explanation / Answer

class Contact
{
   String firstName, lastName, phone, email;

}

class PhoneBook extends Contact
{
   List<String[]> contact = new ArrayList<String[]>();

String[] contacts = new String[4];

   public static void addContact(String f, String l, String p, String e)
   {
       contacts[0]=f;
       contacts[1]=l;
       contacts[2]=p;
       contacts[3]=e;
       contact.add(contacts);
   }

   public static void main(String args[])
   {
       PhoneBook o= new PhoneBook();
       o.addContact("Aa","Ba","12","aa@gmail.com");
   }
}


     

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote