public static void GetContactFromPb(PhoneDirectory input) { Console.WriteLine("Please enter contact name:"); var name = Console.ReadLine(); if (input.GetNumber(name) == null) { Console.WriteLine($"Sorry, no contact {name} in Phone Book!"); } else { Console.WriteLine($"Name: {name}, Number: {input.GetNumber(name)}"); } Console.ReadKey(); }
private static void Main(string[] args) { PhoneDirectory myDirectory = new PhoneDirectory("Marija B.", "22222222"); myDirectory.PutNumber("Jon Snow", "999999999"); myDirectory.PrintPhoneDirectory(); myDirectory.GetNumber("Marija B."); }
public static void GetAllContactsFromPb(PhoneDirectory input) { if (input.GetLength() == 0) { Console.WriteLine("Sorry, no entries in Phone Book!"); } else { for (int i = 0; i < input.GetLength(); i++) { Console.WriteLine($"Name: {input.GetName(i)}, Number: {input.GetNumber(input.GetName(i))}"); } } Console.ReadKey(); }