Write a Java 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,...

1 answer below »
Write a Java 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 use a Linked List structure to store the directory entries and should be able to perform the following basic functions. The directory should remain sorted after each of the operations below: (1) Display the entire directory (2) Delete an entry in the directory (3) Search and display the contents of a particular entry (4) Insert an entry into the directory You must use three classes: Entry class, Directory class, and a Driver class. You must use the starter code attached to this document. The starter code includes code for the entry class and the driver class. You must write your own Directory class and modify the driver class as needed to test additional functionalities not currently included in the Driver class. You should submit a zip folder with your java project. Your project must be well documented.


1 CS 115 Fall 2021 Instructor: I. Russell Project 5 Absolute Due Date: 11:59 p.m. Monday December 6 Write a Java 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 use a Linked List structure to store the directory entries and should be able to perform the following basic functions. The directory should remain sorted after each of the operations below: (1) Display the entire directory (2) Delete an entry in the directory (3) Search and display the contents of a particular entry (4) Insert an entry into the directory You must use three classes: Entry class, Directory class, and a Driver class. You must use the starter code attached to this document. The starter code includes code for the entry class and the driver class. You must write your own Directory class and modify the driver class as needed to test additional functionalities not currently included in the Driver class. You should submit a zip folder with your java project. Your project must be well documented. What to submit Submit your work via Blackboard’s assignment tool. You should submit a zip folder with your java project. Your project must be well documented. Make sure to run the javadoc program to obtain a prettily formatted version of your documentation in HTML format. Instructions on how to use Blackboard are available at: http://uhaweb.hartford.edu/fcld/handoutsstudent.htm The folder should also have a document that includes: (1) Your name, instructor’s name, date created and last update. (2) Documentation, good test cases and reasons for selecting them, screen shots, a summary of the results of your testing which should clearly document that your project works as per specifications, http://uhaweb.hartford.edu/fcld/handoutsstudent.htm 2 and a paragraph reflecting on your work including comments on how you would do the assignment differently if you were to do it again. You are encouraged to seek feedback on your work on the project from me, and from the computer science tutors (schedule posted on Blackboard). Grading Criteria 35% Program running correctly as per specification. 20% Design: classes, methods, variables…etc 25% Testing: Good selection of test cases. Screen shots corresponding to the test cases, a summary of your testing, and a reflection paragraph as stated above. 20% Documentation as per class discussion. Plagiarism Plagiarism is representing someone else’s work as your own. You are not to copy programs or other work from any source including books and the internet without proper citation. You are expected to submit your own work. You may discuss an assignment with the tutors in the CS lab and certainly with me, but you are expected to submit your own work on all assignments. Any assignments that are copied will be given a grade of zero as well as the ones that were copied from. The students involved will be subject to further disciplinary action. The academic honesty policy is described in the student handbook, the Source, which is available online at http://www.hartford.edu/thesource. http://www.hartford.edu/thesource import java.util.Scanner; public class Driver { public static void main(String[] args) { Scanner scan = new Scanner(System.in); boolean run = true; //Make a bool to run our while loop later String command; //Make a string to store user commands in later Directory dir = new Directory(); //Create the directory with size based on user input while(run) { System.out.println("Please enter a command or enter 'help' to display a list of commands."); command = scan.nextLine(); //Read the user input switch(command) //Perform different functions depending on user input { case("help"): help(); break; //Prints instructions to screen case("insert"): insert(scan, dir); break; //Prompts user for some info then creates a new entry case("search"): search(scan, dir); break; //Prompts user for some info then searches for an entry case("display"): System.out.println(dir.toString()); break; //Prints the whole directory to screen case("quit"): run = false; break; //Ends the loop default: break; //Nothing happens if they enter something that isn't a valid command } } } public static void help() //Helper method to print out instructions for user { System.out.println("Enter 'insert' to add an entry, 'search' to find and show an existing entry, 'display' to show the entire directory, or 'quit' to end the program."); } public static void insert(Scanner scan, Directory dir) //Helper method that does all the insert stuff { System.out.println("Please enter the full name of the person to enter."); String name = scan.nextLine(); //Get name from user System.out.println("Please enter the full address of the person to enter."); String address = scan.nextLine(); //Get address from user System.out.println("Please enter the phone number of the person to enter."); String phone = scan.nextLine(); //Get phone number from user dir.insert(new Entry(name, address, phone)); //Create entry with characteristics from above } public static void search(Scanner scan, Directory dir) //Helper method that searches { System.out.println("Please enter the full name of the person to search for."); String name = scan.nextLine(); //Get name from user dir.search(name); //Search directory using the name from above } } public class Entry { private String fullName; private String fullAddress; private String phone; public Entry(String name, String address, String phoneNumber) //Constructor { fullName = name; fullAddress = address; phone = phoneNumber; } public String getName(){return fullName;} //Returns the name associated with the entry public void setName(String n){fullName = n;} //Changes the name associated with the entry public String getAddress(){return fullAddress;} //Returns the address associated with the entry public void setAddress(String a){fullAddress = a;} //Changes the name associated with the entry public String getPhone(){return phone;} //Returns the phone number associated with the entry public void setPhone(String p){phone = p;} //Changes the phone number associated with the entry public String toString(){return "Name: " + fullName + ", Address: " + fullAddress + ", Phone Number: " + phone;} //Returns the whole entry in string form }
Answered 2 days AfterNov 30, 2021

Answer To: Write a Java program that creates and manipulates a directory of names, telephone numbers, and home...

Vaibhav answered on Dec 03 2021
122 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here