By GokiSoft.com| 09:40 01/11/2021|
C Sharp

[Examination] Thi thực hành môn C# - C Sharp

Thời Gian Thi: 14h40 - 15h40

Muộn 1 phút trừ 0.5 điểm 

Phản hồi từ học viên

5

(Dựa trên đánh giá ngày hôm nay)

Trương Công Vinh [T1907A]
Trương Công Vinh

2020-06-05 08:43:33



using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
namespace ContactManager
{
    class Program
    {
        static int c;
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Console.OutputEncoding = Encoding.UTF8;
            List<string> sdtList = new List<string>();
            Hashtable hashtableContact = new Hashtable();
            
            do
            {
                menu();
                inputChoose();
                switch (c)
                {
                    case 1:
                        addContact(hashtableContact,sdtList);
                        break;
                    case 2:
                        findContact(hashtableContact);
                        break;
                    case 3:
                        displayContact(hashtableContact);
                        break;

                    case 4:
                        Console.WriteLine("EXIT!");
                        break;


                    default:
                        break;
                }

            } while (c!=4);
        }
        static void displayContact(Hashtable hashtableContact)
        {
            foreach (Contac item in hashtableContact.Values)
            {
                
                    item.display();
                
            }
        }
        static void findContact(Hashtable hashtableContact)
        {
            bool isFind = false;
            Console.WriteLine("Enter name's contact to find : ");
            string find = Console.ReadLine();
            foreach (Contac item in hashtableContact.Values)
            {
               
                if (item.name.Equals(find))
                {
                    item.display();
                    
                }
            }
        }
        static void addContact(Hashtable hashtableContact, List<string> sdtList)
        {
            Contac contac = new Contac();
            contac.input(sdtList);
            hashtableContact.Add(contac.name,contac);
        }
        static void menu()
        {
            Console.WriteLine("o 1. Add new contact");
            Console.WriteLine("o 2. Find a contact by name");
            Console.WriteLine("3. Display contacts");
            Console.WriteLine("o 4. Exit");
            
        }

        static void inputChoose()
        {
            bool ischeck = true;
            while (ischeck)
            {
                Console.WriteLine("Choose : ");
                string choose = Console.ReadLine();
                if (string.IsNullOrEmpty(choose) == false && checkInt(choose))
                {
                    c = int.Parse(choose);
                    ischeck = false;
                }
                else
                {
                    Console.WriteLine("Error !!!");

                }
            }

        }
        static bool checkInt(string s)
        {
            bool check = true;
            foreach (char item in s)
            {
                if (item < 48 || item > 57)
                {
                    check = false;
                    break;
                }

            }
            return check;
        }
    }
}



using System;
using System.Collections.Generic;
using System.Text;

namespace ContactManager
{
    class Contac
    {
        public string name { get; set; }
        public string sdt { get; set; }


        public Contac()
        {

        }
        public void input(List<string> sdtList)
        {
            inputName();
            inputSDT(sdtList);
        }
        private void inputName()
        {
            
            while (true)
            {
                
                Console.WriteLine("Enter contact name :");
                name = Console.ReadLine();
                if (string.IsNullOrEmpty(name) == false)
                {
                   
                    break;
                }
                else
                {
                    Console.WriteLine("Contact name is empty !!!");
                }
            }
        }
        private void inputSDT(List<string> sdtList)
        {


            bool ischeck = false;
            while (!ischeck)
            {
                Console.WriteLine("Enter Telephone number :");

                string c2 = Console.ReadLine();
                 if (checkInt(c2) && string.IsNullOrEmpty(c2) == false&&c2.Length==10)
                {
                    sdt = c2;
                    ischeck = true;
                    
                }
                else
                {
                    Console.WriteLine("Error !!");
                }
                if (ischeck)
                {
                    bool isExit = false;
                    foreach (var item in sdtList)
                    {
                        if (item.Equals(sdt))
                        {
                            Console.WriteLine("Contact is exist !!");
                            ischeck = false;
                            isExit = true;
                        }
                        
                    }
                    if (!isExit)
                    {
                        ischeck = true;
                    }
                }
            }

        }
        public void display()
        {
            Console.WriteLine("Name : {0} | Sdt : {1}",name,sdt);
        }
        bool checkInt(string s)
        {
            bool check = true;
            foreach (char item in s)
            {
                if (item < 48 || item > 57)
                {
                    check = false;
                    break;
                }

            }
            return check;
        }

    }
}



NguyenHuuThanh [T1907A]
NguyenHuuThanh

2020-06-05 08:43:15



sua lai main :



using System;
using System.Collections;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable ht = new Hashtable();
            int choice;
            do
            {
                showMenu();
                Console.WriteLine("Moi ban nhap vao choice :");
                choice = int.Parse(Console.ReadLine());

                switch(choice)
                {
                    case 1:
                        
                        for(; ;)
                        {
                            Console.WriteLine("Nhap vao contact :");
                            Contact contact = new Contact();
                            contact.input();

                            ht.Add(contact.contactname , contact.phonenumber);

                            Console.WriteLine("Ban co muon nhap tiep khong ? Y/N");
                            String option;
                            option = Console.ReadLine();
                            if(option.Contains("N"))
                            {
                                break;
                            }

                        }
                        break;
                    case 2:
                        Console.WriteLine("Moi ban nhap vao ten :");
                        String name;
                        name = Console.ReadLine();

                        ICollection key01 = ht.Keys;

                        foreach (string k in key01)
                        {
                            if (k.Equals(name))
                            {
                                Console.WriteLine(ht[k]);
                            }
                        }
                        if(!ht.ContainsKey(name))
                        {
                            Console.WriteLine("Not found");
                        }
                        break;
                    case 3:
                        ICollection key = ht.Keys;

                        foreach(string k in key)
                        {
                            Console.WriteLine(k + " :" + ht[k]);
                        }
                        break;
                    case 4:
                        Console.WriteLine("Exit");
                        break;
                    default:
                        Console.WriteLine("Error");
                        break;
                }
            } while (choice != 4);
            
        }

        public static void showMenu()
        {
            Console.WriteLine("1  Add a new Contact");
            Console.WriteLine("2. Find a Contact by name ");
            Console.WriteLine("3. Display Contact  ");
            Console.WriteLine("4. Exit ");
        }
    }
}



Phạm Ngọc Minh [T1907A]
Phạm Ngọc Minh

2020-06-05 08:42:34




using System;
using System.Collections;

namespace BaithiC
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable hash = new Hashtable();
            int choice;
            do
            { 
                Console.WriteLine("1.Add Contact Name");
                Console.WriteLine("2.Find a Contact By Name");
                Console.WriteLine("3.Display Contact");
                Console.WriteLine("4.Exit");
                choice = int.Parse(Console.ReadLine());
                switch (choice)
                {
                    case 1:
                        new MethodContact().add(hash);
                        break;
                    case 2:
                        new MethodContact().search(hash);
                        break;
                    case 3:
                        new MethodContact().display(hash);
                        break;
                    case 4:
                        break;
                }
            } while (choice != 4);
        }
    }
}



using System;
using System.Collections.Generic;
using System.Text;

namespace BaithiC
{
    class Contactmanager
    {
        public string ContactName { get; set; }
        public string PhoneNumber { get; set; }
        public Contactmanager()
        {}
        public Contactmanager(string contact, string phone)
        {
            ContactName = contact;
            PhoneNumber = phone;
        }
    }
}



using System;
using System.Collections;

namespace BaithiC
{
    class MethodContact
    {
        public Hashtable add(Hashtable hash)
        {
            Contactmanager cm = new Contactmanager();
            Console.Write("Contact name: ");
            cm.ContactName = Console.ReadLine();
            Console.Write("Phone number: ");
            cm.PhoneNumber = Console.ReadLine();

                if (cm.ContactName.Length != 0 && cm.PhoneNumber.Length != 0)
            {
                hash.Add(cm.ContactName, cm.PhoneNumber);
            }
            return hash;
        }
        public void display(Hashtable hash)
        {
            ICollection key = hash.Keys;
            Console.WriteLine("ContactName\t\tNumberPhone");
            foreach (string s in key)
            {
                Console.WriteLine("\t" + s + "\t\t\t" + hash[s]);
            }
        }
        public Hashtable search(Hashtable hash)
        {
            Console.Write("Enter name search: ");
            string name = Console.ReadLine();
            Console.WriteLine("ContatName\t\tNumberPhone");
            int flag = 0;
            ICollection key = hash.Keys;
            foreach (string s in key)
            {
                if (s.Equals(name))
                {
                    Console.WriteLine("\t" + s + "\t\t\t" + hash[s]);
                    flag = 1;
                }
            }
            if (flag == 0)
            {
                Console.WriteLine("Not found");
            }
            return hash;
        }
    }
}



Trần Mạnh Dũng [T1907A]
Trần Mạnh Dũng

2020-06-05 08:41:28


#Contact.cs


using System;
using System.Collections.Generic;
using System.Text;

namespace contactManager1
{
    class Contact
    {
        public string contactName { get; set; }
        public int phoneNumber { get; set; }
        public Contact()
        {

        }
        public Contact(String contactName, int phoneNumber)
        {
            this.contactName = contactName;
            this.phoneNumber = phoneNumber;
        }
        public void inputphonenumber()
        {
            Console.Write("Enter a contact name: ");
            contactName = Console.ReadLine();
            Console.Write("Enter a phone number: ");
            phoneNumber = int.Parse(Console.ReadLine());
        }
        public void outputphonenumber()
        {
            Console.WriteLine("Contact Name: {0} \nPhone Number:{1}");
        }
    }
}


#Program.cs


using System;
using System.Collections;

namespace contactManager1
{
    class Program
    {
        static void Main(string[] args)
        {
            int choose;
            Hashtable contact = new Hashtable();

            do
            {
                Menu();
                choose = int.Parse(Console.ReadLine());
                switch (choose)
                {
                    case 1:
                        Console.Write("Enter a number contact: ");
                        int n = int.Parse(Console.ReadLine());
                        for (int i = 1; i <= n; i++)
                        {
                            Contact ct = new Contact();
                            Console.WriteLine("Contact number {0}:", n);
                            ct.inputphonenumber();
                            contact.Add(ct.contactName, ct.phoneNumber);
                        }
                        break;
                    case 2:
                        Console.Write("Enter a contac name: ");
                        string name = Console.ReadLine();
                        if (contact.ContainsKey(name))
                        {
                            Console.WriteLine(name+"\t"+contact[name]);
                        }
                        else
                        {
                            Console.WriteLine("Not found");
                        }
                        break;
                    case 3:
                        Console.WriteLine("==============");
                        foreach (DictionaryEntry item in contact)
                        {
                            Console.WriteLine(item.Key + "\t" + item.Value);
                        }
                        break;
                    case 4:
                        break;
                    default:
                        break;
                }

            } while (choose != 4);
        }
        static void Menu()
        {
            Console.WriteLine("1. Add new contact");
            Console.WriteLine("2. Find a contact by name");
            Console.WriteLine("3. Display contacts");
            Console.WriteLine("4. Exit");
            Console.Write("Choose: ");
        }
    }
    
}



Phan Bạch Tùng Dương [T1907A]
Phan Bạch Tùng Dương

2020-06-05 08:40:26



using System;
using System.Collections;
using System.ComponentModel.DataAnnotations;

namespace ExamCSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable hash = new Hashtable();
            int choose;
            do
            {
                Display();
                choose = int.Parse(Console.ReadLine());
                switch (choose)
                {
                    case 1:
                        new MethodContact().Add(hash);
                        break;
                    case 2:
                        new MethodContact().Search(hash);
                        break;
                    case 3:
                        new MethodContact().Display(hash);
                        break;
                    case 4:
                        break;
                }
            } while (choose != 4);
        }
        public static void Display()
        {         
            Console.WriteLine("1. Add new contact: ");
            Console.WriteLine("2. Find a contact by name: ");
            Console.WriteLine("3. Display contact: ");
            Console.WriteLine("4. Exit.");
        }
    }
}



using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace ExamCSharp
{
    class MethodContact
    {
        public Hashtable Add(Hashtable hash)
        {
            ContactManager cm = new ContactManager();
            Console.Write("Contact name: ");
            cm.ContactName = Console.ReadLine();
            Console.Write("Phone number: ");
            cm.PhoneNumber = Console.ReadLine();

            if(cm.ContactName.Length != 0 && cm.PhoneNumber.Length != 0)
            {
                hash.Add(cm.ContactName, cm.PhoneNumber);
            }
            return hash;
        }

        public void Display(Hashtable hash)
        {
            ICollection key = hash.Keys;
            Console.WriteLine("ContactName\t\tPhoneNNumber");
            foreach(string s in key)
            {
                Console.WriteLine(s + "\t\t\t" + hash[s]);
            }
        }

        public Hashtable Search(Hashtable hash)
        {
            Console.Write("Enter name search: ");
            string name = Console.ReadLine();
            Console.WriteLine("ContactName: \t\tPhoneNNumber: ");
            int flag = 0;
            ICollection key = hash.Keys;
            foreach (string s in key)
            {
                if (s.Equals(name))
                {
                    Console.WriteLine(s + "\t\t\t" + hash[s]);
                    flag = 1;
                }
            }
            if(flag == 0)
            {
                Console.WriteLine("!!! Name not found !!!");
            }
            return hash;
        }
    }
}



using System;
using System.Collections.Generic;
using System.Text;

namespace ExamCSharp
{
    class ContactManager
    {
        public string ContactName { get; set; }
        public string PhoneNumber { get; set; }
        public ContactManager() 
        {
            
        }

        public ContactManager(string contactname, string phonenumber)
        {
            ContactName = contactname;
            PhoneNumber = phonenumber;
        }
    }
}



NguyenHuuThanh [T1907A]
NguyenHuuThanh

2020-06-05 08:39:01



using System;
using System.Collections.Generic;
using System.Text;

namespace Main
{
    class Contact
    {
        public string contactname { get; set; }
        public string phonenumber { get; set; }

        public Contact()
        {

        }

        public void input()
        {
            Console.WriteLine("Moi ban nhap vao contactName :");
            contactname = Console.ReadLine();
            Console.WriteLine("Moi ban nhap vao phonenumber :");
            phonenumber = Console.ReadLine();
        }
        

        public void display()
        {
            Console.WriteLine("Contactname : {0} , phonenumber : {1}", contactname, phonenumber); 
        }
    }
}
using System;
using System.Collections;

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable ht = new Hashtable();
            int choice;
            do
            {
                showMenu();
                Console.WriteLine("Moi ban nhap vao choice :");
                choice = int.Parse(Console.ReadLine());

                switch(choice)
                {
                    case 1:
                        
                        for(; ;)
                        {
                            Console.WriteLine("Nhap vao contact :");
                            Contact contact = new Contact();
                            contact.input();

                            ht.Add(contact.contactname , contact.phonenumber);

                            Console.WriteLine("Ban co muon nhap tiep khong ? Y/N");
                            String option;
                            option = Console.ReadLine();
                            if(option.Contains("N"))
                            {
                                break;
                            }

                        }
                        break;
                    case 2:
                        Console.WriteLine("Moi ban nhap vao ten :");
                        String name;
                        name = Console.ReadLine();

                        ICollection key01 = ht.Keys;

                        foreach (string k in key01)
                        {
                            if (k.Equals(name))
                            {
                                Console.WriteLine(ht[k]);
                            }
                        }
                        break;
                    case 3:
                        ICollection key = ht.Keys;

                        foreach(string k in key)
                        {
                            Console.WriteLine(k + " :" + ht[k]);
                        }
                        break;
                    case 4:
                        Console.WriteLine("Exit");
                        break;
                    default:
                        Console.WriteLine("Error");
                        break;
                }
            } while (choice != 4);
            
        }

        public static void showMenu()
        {
            Console.WriteLine("1  Add a new Contact");
            Console.WriteLine("2. Find a Contact by name ");
            Console.WriteLine("3. Display Contact  ");
            Console.WriteLine("4. Exit ");
        }
    }
}



Đỗ Văn Huấn [T1907A]
Đỗ Văn Huấn

2020-06-05 08:38:30



using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaiThiCsharp
{
    class ContactManager
    {

        
        static void Main(string[] args)
        {
            Hashtable hash = new Hashtable();
            int choose;
            do
            {
                show();
                choose = Int32.Parse(Console.ReadLine());
                switch (choose)
                {
                    case 1:
                        Console.WriteLine("Enter the number of contacts to add:");
                        int n = Int32.Parse(Console.ReadLine());
                        Input(n, hash);
                        break;
                    case 2:
                        Search(hash);
                        break;
                    case 3:
                        Display(hash);
                        break;
                    case 4:
                        Console.WriteLine("Exit success");
                        break;
                    default:
                        Console.WriteLine("Error");
                        break;
                }

            } while (choose != 4);

        }
        private static void show()
        {
            Console.WriteLine("1. Add new contact");
            Console.WriteLine("2. Find a contact by name");
            Console.WriteLine("3. Display contacts");
            Console.WriteLine("4. Exit");
            Console.WriteLine("Enter choose: ");
        }

        private static void Input(int n, Hashtable hash)
        {
            for(int i =0; i < n; i++)
            {
                Phone phone = new Phone();
                phone.Input();
                hash.Add(phone.Name, phone.PhoneNumber);
            }
        }
        private static void Display(Hashtable hash)
        {
            ICollection key = hash.Keys;

            foreach (string k in key)
            {
                Console.WriteLine(k + ": " + hash[k]);
            }

        }

        private static void Search(Hashtable hash) {
            ICollection key = hash.Keys;
            Console.WriteLine("Enter name to searh: ");
            string name = Console.ReadLine();
            foreach (string k in key)
            {

                if (name.Equals(k))
                {
                  Console.WriteLine(k + ": " + hash[k]);
                }
                else
                {
                    Console.WriteLine("No names in contacts");
                }
               
            }
        }

    }
}



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaiThiCsharp
{
    class Phone
    {
        public string Name { get; set; }

        public int PhoneNumber { get; set; }
       
        public void Input()
        {
            bool ischeck = true;
            while (ischeck)
            {
                Console.Write("Enter name: ");
                Name = Console.ReadLine();
                if (string.IsNullOrEmpty(Name) == false)
                {
                    ischeck = false;
                }
                else
                {
                    Console.WriteLine("Enter error.");
                }
            }
                Console.WriteLine("Enter phone number: ");
                PhoneNumber = Int32.Parse(Console.ReadLine());
        }

        public void Display()
        {
            Console.WriteLine("Name: {0}; phone number: {1}", Name, PhoneNumber);
        }

    }
}



Trần Anh Quân [T1907A]
Trần Anh Quân

2020-06-05 08:38:20



using ContactManager;
using System;
using System.Collections;

namespace exdm
{
    class Program
    {
    
        static void Main(string[] args)
        {
            Hashtable h = new Hashtable();

            int choice;
            do
            {
                Console.WriteLine("1.Add new contact");
                Console.WriteLine("2.Find a contact by name");
                Console.WriteLine("3.Display contact");
                Console.WriteLine("4.Exit");
                Console.Write("Choose:");
                choice = int.Parse(Console.ReadLine());
                switch (choice)
                {
                    case 1:
                        new MethodContact().add(h);
                        break;
                    case 2:
                        new MethodContact().search(h);
                        break;
                    case 3:
                        new MethodContact().display(h);
                        break;
                    case 4:
                        break;

                }
            } while (choice != 4);
        }
    }
}



using System;
using System.Collections;

namespace ContactManager
{
    class MethodContact
    {
        public Hashtable add(Hashtable h)
        {
            Contactmanager ctm = new Contactmanager();

            Console.Write("Contact Name: ");
            ctm.ContactName = Console.ReadLine();
            Console.Write("Number Phone: ");
            ctm.PhoneNumber = Console.ReadLine();

            if (ctm.ContactName.Length != 0 && ctm.PhoneNumber.Length != 0)
            {
                h.Add(ctm.ContactName, ctm.PhoneNumber);

            }
            return h;
        }

        public void display(Hashtable h)
        {
            Console.WriteLine("================AddressBook============");
            ICollection key = h.Keys;
            Console.WriteLine("\tContactName\t\tNumberPhone");
            foreach (string s in key)
            {
                Console.WriteLine("\t" + s + "\t\t" + h[s]);
            }
        }

        public Hashtable search(Hashtable h)
        {
            Console.Write("Enter Name: ");
            string name = Console.ReadLine();
            int a = 0;
            ICollection key = h.Keys;
            foreach (string s in key)
            {
                if (s.Equals(name))
                {
                    Console.WriteLine("\t" + s + "\t\t\t" + h[s]);
                    a = 1;
                }
            }
            if (a == 0)
            {
                Console.WriteLine("Not Found!");
            }
            return h;
        }
    }
}



using System;

namespace ContactManager
{
    class Contactmanager
    {
        public string ContactName { get; set; }
        public string PhoneNumber { get; set; }
        public Contactmanager()
        {
        }
        public Contactmanager(string contactname, string phone)
        {
            ContactName = contactname;
            PhoneNumber = phone;
        }
    }
}



Luong Dinh Dai [T1907A]
Luong Dinh Dai

2020-06-05 08:33:37


#Contactmanager.cs


using System;
using System.Collections.Generic;
using System.Text;

namespace thithuchanh
{
    class Contactmanager
    {
        public string Name { get; set; }
        public string Phone { get; set; }

        public void input()
        {
            Console.WriteLine("Input Contact name: ");
            Name = Console.ReadLine();
            Console.WriteLine("Input  Phone number: ");
            Phone = Console.ReadLine();
        }
        public void output()
        {
            Console.WriteLine("Contact name: "+ Name+"\n Phome number: "+Phone);
        }
    }

}


#Program.cs


using System;
using System.Collections;

namespace thithuchanh
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable hash = new Hashtable();
            Program pr = new Program();
            int sw;
            do
            {
                pr.menu();
                sw = Convert.ToInt32(Console.ReadLine());
                switch (sw)
                {

                    case 1:
                        Console.WriteLine("input N Contact ");
                        int number = Convert.ToInt32(Console.ReadLine());
                        for (int i = 0; i < number; i++)
                        {
                            Contactmanager contact = new Contactmanager();
                            contact.input();
                            hash.Add(contact.Name, contact.Phone);
                        }
                        break;

                    case 2:

                        Console.WriteLine("input ContactName find ");
                        string find = Console.ReadLine();
                        if (hash[find] == null)
                        {
                            Console.WriteLine("not found");
                        }
                        else
                        {
                            Console.WriteLine(find + "\t" + hash[find]);
                        }




                        break;
                    case 3:

                        ICollection key = hash.Keys;

                        foreach (string i in key)
                        {
                            Console.WriteLine(i + ": " + hash[i]);
                        }

                        break;
                }
            } while (sw != 4);
        }
        public void menu()
        {
            Console.WriteLine("1. Add new contact \n2. Find contact by name \n3. Display contacts \n4. Exit \n");
        }
    }
}



thienphu [T1907A]
thienphu

2020-06-05 08:20:36


#Contact.cs


using System;
using System.Collections.Generic;
using System.Text;

namespace DeThi
{
    class Contact
    {
        public string ContactName { get; set; }
        public int Phone { get; set; }

        public Contact() { }
        public Contact(string contactName,int phone)
        {
            ContactName = contactName;
            Phone = phone;
        }
        public void input()
        {
            
            Console.WriteLine("input contactName ");
            ContactName = Console.ReadLine();
            Console.WriteLine("input Phonenumber ");
            Phone = Convert.ToInt32(Console.ReadLine());
        }
        public void display()
        {
            Console.WriteLine("{0} \t {1}", ContactName, Phone);
        }
    }
}


#Manage.cs


using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace DeThi
{
    class Manage
    {
        public static void AddContact(Hashtable ht)
        {
            Console.WriteLine("input N Contact ");
            int number = Convert.ToInt32(Console.ReadLine());
            for (int i = 0; i < number; i++)
            {
                Contact ct = new Contact();
                ct.input();
                ht.Add(ct.ContactName, ct.Phone);
            }
        }
        public static void searhByContactName(Hashtable ht)
        {
            Console.WriteLine("input ContactName find ");
            string find = Console.ReadLine();
            ICollection key = ht.Keys;
            var isCheck = false;
            foreach (string k in key)
            {
                if (k.Equals(find))
                {
                    isCheck = true;
                    break;
                }
                
            }
            if (isCheck)
            {
                Console.WriteLine("Information Contact ");
                Console.WriteLine(find + ": " + ht[find]);
                return;
            }
            Console.WriteLine("not found ");


        }
        public static void display(Hashtable ht)
        {
            ICollection key = ht.Keys;
            Console.WriteLine("-------Address Book-------");
            Console.WriteLine("Contact Name\t Phone Numebr");
            foreach (string k in key)
            {
                Console.WriteLine(k + "\t \t" + ht[k]);
            }
        }
    }
}


#Program.cs


using System;
using System.Collections;

namespace DeThi
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable ht = new Hashtable();
            int choose;
            do
            {
                showmenu();
                choose = Convert.ToInt32(Console.ReadLine());
                switch (choose)
                {
                    case 1:
                        Manage.AddContact(ht);
                        break;
                    case 2:
                        Manage.searhByContactName(ht);
                        break;
                    case 3:
                        Manage.display(ht);
                        break;
                    case 4:
                        Console.WriteLine("exit success ");
                        break;
                    default:
                        Console.WriteLine("nhap sai roi, chon lai di");
                        break;
                }
            } while (choose != 4);
        }
        public static void showmenu()
        {
            Console.WriteLine("1. Add new contact ");
            Console.WriteLine("2. Find a contact by name ");
            Console.WriteLine("3. Display contacts ");
            Console.WriteLine("4. Exit ");
            Console.WriteLine("Choose");
        }

    }
}