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)

Đỗ tuấn anh [T1907A]
Đỗ tuấn anh

2020-06-05 08:49:55



using System;
using System.Collections.Generic;
using HashTable.ContactManager;

namespace HashTable
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            List<Manager> managers = new List<Manager>();
            int choose;

            do
            {
                ShowMenu();
                choose = int.Parse(Console.ReadLine());
                switch(choose)
                {
                    case 1:
                        InputManager(managers);
                        break;
                    case 2:
                     
                        break;
                    case 3:
                        DisplayManager(managers);
                        break;
                    case 4:
                        Console.WriteLine("Thoat chuong trinh");
                        break;
                    default:
                        Console.WriteLine("Nhap sai cu phap !");
                        break;
                          
                }
            } while (choose != 4);
        }
        static void InputManager(List<Manager> managers)
        {

            Manager manager = new Manager();
            manager.Input();
            managers.Add(manager);
        }
        static void DisplayManager(List<Manager> managers)
        {
            foreach(Manager manager in managers)
            {
                manager.Display();
            }
        }
        static void ShowMenu()
        {
            Console.WriteLine("1.Them lien he moi");
            Console.WriteLine("2.Tim mot lien he theo ten");
            Console.WriteLine("3.Hien thi Danh Ba");
            Console.WriteLine("4.Thoat!");
            Console.WriteLine("Choose :");
        }
    }
}



using System;
namespace HashTable.ContactManager
{
    public class Manager
    {
        public string FullName { get; set; }
        public int Phone { get; set; } 
        public Manager()
        {
        }
        public void Input()
        {
            Console.WriteLine("Nhap ten cua khach hang :");
            FullName = Console.ReadLine();
            Console.WriteLine("Nhap So dien thoai khach hang !");
            Phone = Convert.ToInt32(Console.ReadLine());
        }
        public void Display()
        {
            Console.WriteLine("Ten : {0},Phone : {1}",FullName,Phone);
        }
    }
}



Đường Thanh Bình [T1907A]
Đường Thanh Bình

2020-06-05 08:48:49



using Microsoft.VisualBasic.FileIO;
using System;
using System.Collections;
using System.ComponentModel.Design;
using System.Globalization;
using System.Security.Cryptography.X509Certificates;

namespace Contact_Manager
{
    class Program
    {
        static void Main(string[] args)
        {
            int choose;
            do
            {
                Console.WriteLine("-------------Menu-------------");
                Console.WriteLine("------------ContactManager------");
                Console.WriteLine("1.Add new contact");
                Console.WriteLine("2.Find a contact by name");
                Console.WriteLine("3.Display contacts");
                Console.WriteLine("4.Exit");

                choose = Int32.Parse(Console.ReadLine());
                switch (choose)
                {
                    case 1:
                        Console.WriteLine("Add new contact");
                        int n = Int32.Parse(Console.ReadLine());
                        Input(n, hash);
                        break;
                    case 2:
                        Console.WriteLine("Find a contact by name");
                        Search(hash);
                        break;
                    case 3:
                        Console.WriteLine("Display contacts");
                        break;
                    case 4:
                        Console.WriteLine("Exit");
                        break;
                    default:
                        Console.WriteLine("choose one more");
                        break;
                }
            } while (choose != 4);
            Console.ReadLine();
        }
    }
    private static void input(int n,Hashtable hashtable)
    {
        for(int i = 0; i< n; i++)
        {
            ContactManager contactManager = new ContactManager();
            contactManager.input();
            hashtable.Add(contactManager.fullname, contactManager.phoneNumber);


        }
    }

}



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

namespace Contact_Manager
{
    class ContactManager
    {
        public string fullname { get; set; }
        public Int32 phoneNumber { get; set; }

        public ContactManager()
        {

        }
        public void input()
        {
            Console.WriteLine("fullname:");
            fullname = Console.ReadLine();
            Console.WriteLine("phoneNumber:");
            phoneNumber = Int32.Parse(Console.ReadLine());
        }
        public void display()
        {
            Console.WriteLine("ContactManager = fullname:{0}, phoneNumber:{1}", fullname, phoneNumber);
        }
    }
}



Đường Thanh Bình [T1907A]
Đường Thanh Bình

2020-06-05 08:48:46



using Microsoft.VisualBasic.FileIO;
using System;
using System.Collections;
using System.ComponentModel.Design;
using System.Globalization;
using System.Security.Cryptography.X509Certificates;

namespace Contact_Manager
{
    class Program
    {
        static void Main(string[] args)
        {
            int choose;
            do
            {
                Console.WriteLine("-------------Menu-------------");
                Console.WriteLine("------------ContactManager------");
                Console.WriteLine("1.Add new contact");
                Console.WriteLine("2.Find a contact by name");
                Console.WriteLine("3.Display contacts");
                Console.WriteLine("4.Exit");

                choose = Int32.Parse(Console.ReadLine());
                switch (choose)
                {
                    case 1:
                        Console.WriteLine("Add new contact");
                        int n = Int32.Parse(Console.ReadLine());
                        Input(n, hash);
                        break;
                    case 2:
                        Console.WriteLine("Find a contact by name");
                        Search(hash);
                        break;
                    case 3:
                        Console.WriteLine("Display contacts");
                        break;
                    case 4:
                        Console.WriteLine("Exit");
                        break;
                    default:
                        Console.WriteLine("choose one more");
                        break;
                }
            } while (choose != 4);
            Console.ReadLine();
        }
    }
    private static void input(int n,Hashtable hashtable)
    {
        for(int i = 0; i< n; i++)
        {
            ContactManager contactManager = new ContactManager();
            contactManager.input();
            hashtable.Add(contactManager.fullname, contactManager.phoneNumber);


        }
    }

}



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

namespace Contact_Manager
{
    class ContactManager
    {
        public string fullname { get; set; }
        public Int32 phoneNumber { get; set; }

        public ContactManager()
        {

        }
        public void input()
        {
            Console.WriteLine("fullname:");
            fullname = Console.ReadLine();
            Console.WriteLine("phoneNumber:");
            phoneNumber = Int32.Parse(Console.ReadLine());
        }
        public void display()
        {
            Console.WriteLine("ContactManager = fullname:{0}, phoneNumber:{1}", fullname, phoneNumber);
        }
    }
}



Nguyễn Văn Quang [T1907A]
Nguyễn Văn Quang

2020-06-05 08:48:38



    using System;
    using System.Collections;

    namespace Thuchanh
    {
        class Program
        {
            static public 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 ");
            }
        }
    }



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

namespace Thuchanh
{
    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);
        }
    }
}



lê văn phương [T1907A]
lê văn phương

2020-06-05 08:48:31



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

namespace Customer
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable hash = new Hashtable(); 
            Console.OutputEncoding = Encoding.UTF8;
            //---
            int choose;
            do
            {
                Show();
                choose = Int32.Parse(Console.ReadLine());
                switch (choose)
                {
                    case 1:
                        Console.WriteLine("Thêm liên hệ mới");
                        int n = Int32.Parse(Console.ReadLine());
                        Input(n, hash);
                        break;
                    case 2:
                        search(hash);
                        break;
                    case 3:
                        Output(hash);
                        break;
                    case 4:
                        Console.WriteLine("thoat thanh cong !!");
                        break;
                    default:
                        Console.WriteLine("loi!!");
                        break;

                }

            } while (choose !=4);
            //---
            Console.ReadKey();
        }
        private static void Show()
        {
            Console.WriteLine("1: Thêm liên hệ mới");
            Console.WriteLine("2. Tìm một liên hệ theo tên");
            Console.WriteLine("3: Hiển thị danh bạ");
            Console.WriteLine("4: Thoát");

        }
        private static void Input(int n,Hashtable hast)
        {
            for(int i = 0; i<n;i++)
            {
                Customer customer = new Customer();
                customer.Input();
                hast.Add(customer.Name, customer.NumberPhone);
            }
        }
        private static void Output(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("Chon search :");
            string name = Console.ReadLine();
            foreach (string k in key)
            {
                if (name.Equals(k))
                {
                    Console.WriteLine(k + ":" + hash[k]);
                }
                else
                {
                    Console.WriteLine("khong tim thay:");
                }
            }

        }
    
    }
}



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

namespace Customer
{
    class Customer
    {
        public string Name { get; set; }
        public int NumberPhone { get; set; }

        public Customer() { }

        public  void Input()
        {

            Console.OutputEncoding = Encoding.UTF8;
            Console.WriteLine("Nhập tên: ");
            Name = Console.ReadLine();

            Console.WriteLine("Nhập số điện thoại: ");
            NumberPhone = Convert.ToInt32(Console.ReadLine());
        }

        public void Output()
        {
            Console.WriteLine("Tên người dùng : {0}, Số điện thoại : {1}", Name, NumberPhone);
        }
    }
}



nguyễn văn huy [T1907A]
nguyễn văn huy

2020-06-05 08:47:58



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

namespace quanlilienhe

{
    class nguoilienhe

    {
        public string Name { get; set; }
        public string Sdt { get; set; }

        public nguoilienhe()
        {

        }

        public void input()
        {
            Console.WriteLine("Moi ban nhap vaoten :");
            Name = Console.ReadLine();
            Console.WriteLine("Moi ban nhap vao sdt :");
           Sdt = Console.ReadLine();
        }


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

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            Hashtable ht = new Hashtable();
            int choice;
            do
            {
                showMenu();
                choice = int.Parse(Console.ReadLine());

                switch (choice)
                {
                    case 1:

                        for (; ; )
                        {
                            Console.WriteLine("Nhap vao contact :");
                            nguoilienhe contact = new nguoilienhe();
                            contact.input();

                            ht.Add(contact.Name, contact.Sdt);

                            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("Laijjjj");
                        }
                        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);

        }

        static void showMenu()
        {
            Console.WriteLine("1 nhap nguoi lien he");
            Console.WriteLine("2. tim theo ten");
            Console.WriteLine("3. hien thi  ");
            Console.WriteLine("4. thoat ");
        }
    }
}



Thành Lâm [T1907A]
Thành Lâm

2020-06-05 08:47:30




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

namespace Ungdung
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;
            Console.WriteLine("============================Ứng Dụng==========================\n\n");

            string click = null;
            int numa;
            do
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.WriteLine("1.Thêm liên hệ  mới.");
                Console.WriteLine("2.Tìm một lên hệ theo tên:");
                Console.WriteLine("3.Hiển thị danh bạ:");
                Console.WriteLine("4.Thoát");
                numa = Int32.Parse(Console.ReadLine());
                switch (numa)
                {
                    case 1:
                        Contact();
                        break;
                    case 2:
                        break;
                    case 3:
                        Show();
                      break;
                   case 4:
                        return;
                        
                    default:
                        break;

              }
               Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("\nBạn có muốn tiếp tục ? y/n");
                click = Console.ReadLine();
            } while (click.Equals("y") == true);

            Console.ReadKey();

            Hashtable h = new Hashtable();
            h.Add("Lâm","0373485924");
            h.Add("Hưng", "0961804222");
            h.Add("Minh", "0374123012");

            foreach(DictionaryEntry element in h)
            {
                String key = (string)element.Key;
                string value = (string)element.Value;
                Console.WriteLine("{0}\t {1}", key, value);
            }
        }

        static void Contact()
        {
            AddContact addcontact = new AddContact();
            

            addcontact.input();

        }
        static void Show()
        {
            AddContact showname = new AddContact();
            Console.WriteLine("Tên Liên lạc \t Số điện thoại");
          showname.display();
        }
        
    }
        
}




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

namespace Ungdung
{
    class AddContact
    {
        public string Contactname { get; set; }
        private string _phonenum;
        public string Phonenum {
            get
            {
                return _phonenum;
            }
            set
            {
                if(value.Length <=10 && value.Length >= 9)
                {
                    this._phonenum = value;
                }
            }
        }

        public void input()
        {
            Console.ForegroundColor = ConsoleColor.White;
            Console.Write("Nhập tên liên lạc:  ");
            Contactname = Console.ReadLine();
            Console.Write("\nNhập số điện thoại: ");
            Phonenum = Console.ReadLine();

        }
        public void display()
        {
            Console.WriteLine(" {0} \t\t  {1}", Contactname, Phonenum);
        }
    }
}



Minh Nghia [T1907A]
Minh Nghia

2020-06-05 08:46:58



using System;

namespace Examination
{
    class ContactManager
    {
        static void Main(string[] args)
        {
            int choose;
            
            HashTable hash = new HashTable();
            do
            {
                ShowMenu();
                choose = int.Parse(Console.ReadLine());

                switch (choose)
                {
                    case 1:
                        hash.Add(hash);
                        break;
                    case 2:
                        hash.Search(hash);
                        break;
                    case 3:
                        hash.Display(hash);
                        break;
                    case 4:
                        Console.WriteLine("Exit");
                        break;
                    default:
                        Console.WriteLine("Retype");
                        break;
                }
            } while (choose != 4);
        }
        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");
        }
    }
}



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

namespace Examination
{
    class Contact
    {
        public string Name { get; set; }
        public string PhoneNumber { get; set; }
       
       

        public Contact() { }

        public Contact(string Name ,string PhoneNumber)
        {
            this.Name = Name;
            this.PhoneNumber = PhoneNumber;
        }
        
       
    }
}



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

namespace Examination
{
    class HashTable
    {
        Contact contact = new Contact();

        public HashTable Add(HashTable hashTable)
        {
            Console.WriteLine("Enter name :");
            contact.Name = Console.ReadLine();
            Console.WriteLine("Enter Phone Number:");
            contact.PhoneNumber = Console.ReadLine();
            return hashTable;
        }
        public void Display(HashTable hashTable)
        {
            ICollection key = hashTable.Keys;
            Console.WriteLine("\tName\t\tPhoneNumber");
            foreach(string s in key)
            {
                Console.WriteLine("\t" + s + "\t\t\t" + hashTable[s]);
            }
            
        }
        public HashTable Search(HashTable hashTable)
        {
            Console.WriteLine("Enter name :");
            string name = Console.ReadLine();
            Console.WriteLine("\n\tName\t\tPhoneNumber");
            int flag = 0;
            ICollection key = hashTable.Keys;
            foreach(string s in key)
            {
                if (s.Equals(name))
                {
                    Console.WriteLine("\t" + s + "\t\t\t" + hashTable[s]);
                    flag = 1;
                }
            }
            if(flag == 0)
            {
                Console.WriteLine("Name not found");
            }
            return hashTable;
        }
    }
}



Lê Minh Bắc [T1907A]
Lê Minh Bắc

2020-06-05 08:46:53



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

namespace ContactManager
{
    class Program
    {
        public static int chosse;
        static void Main(string[] args)
        {
            Hashtable list = new Hashtable();
            do
            {
                menu();
                checkChosse();
                switch (chosse)
                {
                    case 1:
                        case1(list);
                        break;
                    case 2:
                        case2(list);
                        break;
                    case 3:
                        Console.WriteLine("\tAddres Book");
                        Console.WriteLine("Contact Name\tPhone number");
                        foreach (DictionaryEntry item in list)
                        {
                            
                            Console.WriteLine(item.Key + "\t\t" + item.Value);
                        }
                        break;

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


                    default:
                        Console.WriteLine("Nhap sai ---> Nhap lai !!");
                        break;
                }

            } while (chosse != 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");
        }

        static void case1(Hashtable list)
        {
            for (; ; )
            {
                Contact con = new Contact();
                con.input();
                list.Add(con.Name,con.PhoneNumber);
                Console.WriteLine("nhap them contact : (Y/N)");
                string option = Console.ReadLine();
                if (option.ToUpper().Equals("N"))
                {
                    break;
                }
            }
        }

        static void case2(Hashtable list)
        {
            Console.WriteLine("Nhap lien he can tim: ");
            string str = Console.ReadLine();
            bool isCheck = false;
            foreach (DictionaryEntry item in list)
            {
                if (item.Key.Equals(str))
                {
                    Console.WriteLine("Contact Name\tPhone number");
                    Console.WriteLine(item.Key +"\t\t"+ item.Value);
                    isCheck = true;
                    break;
                }
            }
            if (!isCheck)
            {
                Console.WriteLine("Lien he khong ton tai!!");
            }
        }
        private static void checkChosse()
        {
            bool isName = true;
            while (isName)
            {
                string str;
                Console.Write("Chosse: ");
                str = Console.ReadLine();

                if (String.IsNullOrEmpty(str))
                {
                    Console.WriteLine("Lua chon khong duoc de trong!!!");
                }
                else
                {
                    if (check(str))
                    {
                        chosse = int.Parse(str);
                        if (chosse > 0)
                        {
                            isName = false;
                        }
                        else
                        {
                            Console.WriteLine("Lua chon phai > 0");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Lua chon khong duoc nhap chu!! ");
                    }

                }

            }
        }

        static bool check(string s)
        {
            bool checkk = false;
            foreach (char item in s)
            {
                if (item >= 48 && item <= 57)
                {
                    checkk = true;
                }
            }
            return checkk;
        }
    }
}



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

namespace ContactManager
{
    class Contact
    {
        public string Name { get; set; }
        public string PhoneNumber { get; set; }

        public Contact()
        {

        }

        public Contact(string name, string phoneNumber)
        {
            this.Name = name;
            this.PhoneNumber = phoneNumber;
        }

        public void input()
        {
            checkName();
            checkPhoneNumber();
        }

        private void checkName()
        {
            bool isName = true;
            while (isName)
            {
                Console.Write("Nhap Ten: ");
                Name = Console.ReadLine();
                if (String.IsNullOrEmpty(Name))
                {
                    Console.WriteLine("Ten khong duoc de trong!!!");
                }
                else
                {
                    isName = false;
                }
            }
        }

        private void checkPhoneNumber()
        {
            bool isName = true;
            while (isName)
            {
                Console.Write("Nhap SDT: ");
                PhoneNumber = Console.ReadLine();
                if (String.IsNullOrEmpty(PhoneNumber))
                {
                    Console.WriteLine("SDT khong duoc de trong!!!");
                }
                else
                {
                    if (checkInt(PhoneNumber))
                    {
                        isName = false;
                    }
                    else
                    {
                        Console.WriteLine("SDT khong duoc nhap chu!!!");
                    }
                    
                }
            }
        }
        bool checkInt(string s)
        {
            bool check = true;
            foreach (char item in s)
            {
                if (item < 48 || item > 57)
                {
                    check = false;
                    break;
                }

            }
            return check;
        }

        public void display()
        {
            Console.WriteLine(Name+"\t\t"+PhoneNumber);
        }
    }
}



Phí Văn Long [T1907A]
Phí Văn Long

2020-06-05 08:43:58



using System;
using System.Collections;

namespace ContactManager
{
    class Program
    {
        static void Main(string[] args)
        {
            int choose;
            do
            {
                ShowMenu();
                choose = int.Parse(Console.ReadLine());
                switch (choose)
                {
                    case 1:
                       new  ContactManage().AddContact(hashtable);
                        break;
                    case 2:
                        new ContactManage().SearchPhoneNumber(hashtable);
                        break;
                    case 3:
                        new ContactManage().Display(hashtable);
                        break;
                    case 4:
                        Console.WriteLine("Outt");
                        break;
                    default:
                        Console.WriteLine("Error . Number true is 1-4");

                        break;
                }
            } while (choose != 5);
        }
        static void ShowMenu()
        {
                Console.WriteLine("1. Add new Contact");
                Console.WriteLine("2. Find a Contact by name");
                Console.WriteLine("3. Display Contact");
                Console.WriteLine("4. Exit");
                Console.WriteLine("Choose : ");
        }
    }
}



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

namespace ContactManager
{
    class Contact
    {
        public string ContactName { get; set; }
        public string ContactPhoneNumber { get; set; }
        public Contact()
        {
            
        }
        public Contact(string contactName,string PhoneNumber)
        {
            this.ContactName = contactName;
            this.ContactPhoneNumber = PhoneNumber;

        }
    }
}



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

namespace ContactManager
{
    class ContactManage
    {

        public ContactManage AddContact(ContactManage hashtable)
        {
            Contact contact = new Contact();
            Console.WriteLine("ENter Name Contact : ");
            contact.ContactName = Console.ReadLine();
            Console.WriteLine("Enter Phone Number COntact");
            contact.ContactPhoneNumber = Console.ReadLine();



            return hashtable;
        }
        public ContactManage SearchPhoneNumber(ContactManage hashtable)
        {
            Console.WriteLine("Enter the Search Phone Number : ");
            string Phone = Console.ReadLine();
            Console.WriteLine(" Contact Name \t Phone ");
            int flag = 0;
            ICollection key = hashtable.Keys;
            foreach (string check in key)
            {
                if (check.Equals(Phone))
                {
                    Console.WriteLine("s + hash[s]");
                    flag = 1;
                }
            }
            if (flag = 0)
            {
                Console.WriteLine("Error . Name not found !!");
            }
            return hashtable;

        }
        public void Display(ContactManage hashtable)
        {
            ICollection key = hashtable.Keys;
            Console.WriteLine("\tContactName\t\tPhone");
            foreach (string item in key)
            {
                Console.WriteLine("\t" + item + "\t\t\t" + hashtable[item]);
            }
        }

        internal class Display
        {
            private object hashtable;

            public Display(object hashtable)
            {
                this.hashtable = hashtable;
            }
        }
    }
}