Professional Documents
Culture Documents
answers/write-java-menu-driven-program-creates-manipulates-directory-names-telephone-
numbers-home--q3684794
Write a Java menu-driven program that creates and manipulates a directory of names, telephone
numbers, and home addresses. The following information will be stored for each person in the
directory: - Name (Last, First) - Home address (street address, city, state, zip code) - Home
telephone number Your program should be able to perform the following basic functions: -
Display the entire directory - Search and display the contents of a particular entry - Sort the
entire collection by key value (the combination of last and first names) - Delete an existing entry
- Insert an entry to the end of the directory list - Save the entire directory to a file THIS IS MY
class Person { public String name; public String address; public int telephone; }
{ ArrayList personList = new ArrayList(); public static void main(String[] args) { Directory s =
Expert Answer
//Person class
{return name;
}
------------------------------------
import java.util.*;
int choice=getOption();
while(choice!=3)
{switch (choice)
choice=getOption();
}
public static int getOption()
System.out.println("Press 3 to exit");
return choice;
A1.name = sc.nextLine();
A1.address = sc.nextLine();
A1.telephone = Integer.parseInt(sc.nextLine());
personList.add(A1);
System.out.println("list="+personList);
{ temp=personList.get(i);
if(personName.equals(temp.getName()))
{System.out.println("Person Found"+temp);
return;
}
Hide comments (2)
Comments
Would you be able to finish this program? I will add more points.