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

What happens when the input file is empty, What happens when the user searches f

ID: 3886767 • Letter: W

Question

What happens when the input file is empty, What happens when the user searches for "Smth" and the entry in the file is for the name "Smith" What happens when the user types the command ' d ' to delete the current entry?

What does method nextLine() return? Write a description of the method index(String Key).

Appendix 1 Program for Part 1 import java.io.*; import java.util.*; class Contact ( public String name, number, note; public class ReddyPB ( public static Contact[l contactlist; public static int num_entries; public static Scanner stdin = new scanner(system.in); public static void main(Stringl] args) throws Exceptionf int i; char C; String code, Command; contact1st = new contact[1001;

Explanation / Answer

Please find my answer.

What happens when the input file is empty ?

Ans: size of "contactList" array willbe zero. (no contact list)

What happens when the user searches for "Smth" and the entry in the file is for the name "Smith" ?

Ans: "index" method will return the index of phone record of Smith in contactList array

What happens when the user types the command ' d ' to delete the current entry?

Ans: program output following message:

Invalid command Please enter the command again.

What does method nextLine() return?

Ans: it returns the next line in file.

Write a description of the method index(String Key).

Ans: index method returns the index of "Key" in contactList if avaialble. otherwise it returns -1.

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