Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using java, how can I write a program using methods on the first picture to have the results like it is shown in the picture
Using java, how can I write a program using methods on the first picture to have the results like it is shown in the picture
Public Methods the Program Must Provide All eight methods must be implemented as named and as described in order for Web-CAT to be able to test and score them correctly. You may not make any assumptions regarding the number of entries of the 2-D book arrays passed to these methods. That is, it may have any number of rows, but will always have three columns. (This allows for future expansion of your code.) 1. public static void initBook (String111 book) to an empty string initializing the This method will set every element of the array parameter book phone book array to a default state that has no entries in it. 2. public static boolean bookEmpty (String book) This method will return true if the phone book is empty, false otherwise. Must handle null s 3. public static void displayBook (StringlI book) This method will display each entry in the format #. LAST, FIRST (PHONE) , where # is the row in the phonebook array, LAST is the person's last name, FIRST is the person's first name and PHONE is the person's phone number. If there are no entries in the book, display No entries. instead. 4. public static int findEmpty (String book) This method will return an int value corresponding to the first "empty position located in the array starting from row 0.If the array is full (i.e., all rows have an entry), return Must handle nul1 s 5. public static void addEntry (String1 book, Scanner g) If there is an empty/available row, this method will add a new entry to the phone book, asking for first name, then last name, then phone number. Otherwise, the display Phonebook is full! 6. public static void deleteEntry (String book, Scanner g) If there are no entries in the phonebook, the message No entries. should be displayed. Otherwise, the phonebook should be displayed and then the user can select a number from 0 through 9 to delete that entry in the phonebook, any other number to cancel. No data validation is necessary. Deleting an entry means that the first name, last name, and phonebook are all set to an empty stringt will display Record deleted. or No record deleted. as appropriate. 7. public static void sortBook (String book) This method will sort the phonebook entries by last name. You can either implement a bubble sort or a selection sort for this. See "Points to Think About" for information about duplicate last names. The prompt Phonebook sorted ill always display to the screen. 8. public static void menu (String1 book, Scanner g) This method displays a menu and calls the appropriate methods. This method has been provided for you Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
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