CSC20 Project 4 For this project our aim is to create a phone book with contact details. Individual contact information is added to the
CSC20 Project 4 For this project our aim is to create a phone book with contact details. Individual contact information is added to the contact class. Then these contacts are added to the Phone books array list. In a phone book the contacts are arranged in ascending order of first name or last name. Hence we will sort our phone book first by "first name" and then by "last name" using sorting algorithms. Searching contacts is done alphabetically using non-recursive binary search. Steps to Follow class Contact{ 1. Create a class Contact.java use to create individual contacts. The class structure is as follows, } PhoneBook private String firstName; private String lastName; private long homeNumber; private long officeNumber; private String emailAddress; public Contact(String firstName, String lastName, long homeNumber, long office Number, String emailAddress){ // constructor setting all details } Setter methods Getter methods toString method Fa2021 class PhoneBook{ 2. Create class PhoneBook.java to create a phone book with all the contacts. The class structure is as follows, public ArrayList contacts; public PhoneBook(){ } public add(Contact c){ } // create arraylist of contacts by reading data from the file } // add contact to the array list. public toString(){ //returns the entire phone book as string public void bubbleSort(){ //Sort phonebook by first name } public void selection Sort(){ //Sort phone book by last using selection sort algorithm. public boolean binarySearch( String name){ // Search contact by last name using binary search. // return true if contact is found else false } 3. Create a driver class PhoneDriver.java and carry out the following operations, a. Create the PhoneBook. b. Read data from file Contact Details.txt. Each line has new contact info. String tokens[] = inline.split(","); tokens[0] is first name, tokens[1] is last name, tokens[2] is home phone number, tokens[3] is office phone number, tokens[4] is email address Create Contact objects for the above details and add them to the phonebook array list. It there is a "-" at the home or office number set it to 0. c. Create a menu with following options, P: Print Phonebook FirstName Bogdan BrunoApps B: Sort phone book by first name // use bubble sort L: Sort phone book by last name // use selection sort S: Search contact by last name // use binary search A: Add contact to phone book Q. Quit d. Print Phonebook - print() - Write a static function to print Phone book using the toString method of the Phonebook class e. Search contact by last name - search(String lastName) : Write this static function - it prompts user for last name and search the phone book using binary search. If contact found print its details. If contact not found print "Contact Not Found". The Output should look like below, Nigel Buddy Justin f. Add contact method add(): This method prompts the user for contact details and calls the add instance method. A. Print PhoneBook Please enter choice: A Kosta Skal Frank Zach Iman Garret g. Run all the menu options and print the results. // Note: all the functions should be carried out using the given sorting or searching algorithms only. Q Vince Willie De'Aaron Untitle Foxocument My Sao Mail (1) Pro & projec LastName docs.go HomeNumber ocum OfficeNumber Kp EmailAddress 3kDVnoNX-G Bogdanovic 8976786543 4098762541 Cabocio Dictiona 7268725426 Wisch7653627890/UW Carter 5674873628 8746539393 Cauley Harry File Edi Giles Insert Hayes Hield 100% Jackson Koufos Labissiere MasonIII Randolph Shumpert Temple 8765635624 6753452652 3246536753 4536478987 1234536745 2345673418 2344562789 9087676352 5236476540 EUn x 6085542642 Add-ons Help 6756453456 1235437845 4563454764 7645374563 7643678363 1764535290 4543647839 3456472894 9087632342 deAaronFox@xyz.com harryGiles@gmail.com nigelHayes@abc.com buddyHield@gmail.com justinJackson@abc.com kostaKoufos@gmail.com ked IIS skalLabissiere@xyz.com frankMasonIII@gha.com ogdan, E zachRandolph@abc.com imanShumpert@gmail.com 409 garretTemple@gmail.com Bruno, Cabocio,7268725426,7653627 bogdanBogdanovic@abc.com brunoCabocio@xyz.com vinceCarter@gmail.com willieCauley@acb.com Last B. Sort by first name should also print list as above with first name in ascending order C. Sort by last name should also print list as above with last name in ascending order D. Search contact by first name Please enter choice. # Enter the last name to be search : Carter BS Contact Found Please enter choice : D Enter the last name to be search: Jackson Contact Nott Found Q. Quit Please enter choice: Q Good Bye! Grading policies Comments/ JavaDoc is necessary for each class Indentation and good programming style Data validation/reading from a file using try catch exception handling Follow the assignment specifications as given Contact Details -1.txt sections 01, 04 Assignments > Programming Assignment 4 Spring 2... Bogdan, Bogdanovic, 8976786543,4098762541, bogdan Bogdanovic@abc.com Bruno, Cabocio, 7268725426,7653627890, brunoCabocio@xyz.com Vince, Carter, 5674873628,8746539393, vinceCarter@gmail.com Willie, Cauley, 8765635624,-, willie Cauley@acb.com De'Aaron, Fox, 6753452652, 6085542642, de Aaron Fox@xyz.com Harry, Giles, 3246536753,-, harryGiles@gmail.com Nigel, Hayes, -, 6756453456, nigelHayes@abc.com Buddy, Hield, 4536478987,1235437845, buddyHield@gmail.com Justin, Jackson, -, 4563454764, justinJackson@abc.com Kosta, Koufos, 1234536745,7645374563, kostaKoufos@gmail.com Skal, Labissiere, 2345673418,7643678363, skalLabissiere@xyz.com Frank, Mason III, 2344562789,1764535290, frankMasonIII@gha.com Zach, Randolph, -, 4543647839, zachRandolph@abc.com Iman, Shumpert, 9087676352, 3456472894, imanShumpert@gmail.com Garret, Temple, 5236476540,9087632342, garret Temple@gmail.com Download i Info ZOOM + X Close
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Based on the provided project description and structure your task is to create a simple phone book application in Java Heres how you can structure your code Lets start with the Contact class java publ...See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started