Example #1
0
        public doctor get_doc(string specialization)
        {
            Node <doctor> temp   = Doctors;
            doctor        answer = null;

            while (temp != null)
            {
                Console.WriteLine(".");
                if (temp.GetValue().Specialization == specialization)
                {
                    try
                    {
                        if (temp.GetValue().Treatments == null || l(temp.GetValue().Treatments) < l(answer.Treatments))
                        {
                            answer = temp.GetValue();
                        }
                    }
                    catch
                    {
                        answer = temp.GetValue();
                    }
                }
                temp = temp.GetNext();
            }
            return(answer);
        }
Example #2
0
        public void adddoc(string name, string specialization)
        {
            doctor        d    = new doctor(name, specialization);
            Node <doctor> temp = new Node <doctor>(d);

            if (Doctors == null)
            {
                Doctors = temp;
            }
            else
            {
                Doctors.SetNext(temp);
            }
        }
        static void Main(string[] args)
        {
            office o = new office("name");

            o.adddoc("doc name", "heart");

            doctor doc = o.get_doc("heart");

            if (o.Doctors == null)
            {
                Console.WriteLine("test..");
            }

            Console.WriteLine(o.Doctors.GetValue().Specialization);

            Console.WriteLine(doc.Name);


            Console.ReadKey();
        }