CS411 Assignment No.02 Fall 2020

 

using system;

using sysstem.Collection;

 

public delegate bool MyDelegate(object obj1);

 

namespace cs411_assignment_2_soltion

{

                public class MyArraylist : ArrayList

                {

                                public strin vu_id;

                                public static bool retVal;

                               

                               

                                public MyArrayList(string vuID)

                {

                                String n1 = ((MyArrayList)my_vu_ID).vu_id;

                                char[] myID = n1 TocharArray();

                                foreach(char ch in myID)

                                {

                                                if (ch < '0' || '9' > ch)

                                                {

                                                                retVal = true;

                                                }

                                                else

                                                {

                                                                 retVal = false;

                                                }

                                }

                                return retVal;

                }

   }

    class MyListner {

                MyArray[] names = new MyArrayList[11];

                public MyListner()

                {

                                ID_Val[0] = new MyArrayList("B");

                                ID_Val[1] = new MyArrayList("C");

                                ID_Val[2] = new MyArrayList("1");

                                ID_Val[3] = new MyArrayList("9");

                                ID_Val[4] = new MyArrayList("0");

                                ID_Val[5] = new MyArrayList("8");

                                ID_Val[6 = new MyArrayList("4");

                                ID_Val[7] = new MyArrayList("5");

                                ID_Val[8] = new MyArrayList("1");

                                ID_Val[9] = new MyArrayList("0");

                                ID_Val[10] = new MyArrayList("6");

                }

                statics void Main(string[] args)

                {

                                MyListner m1 = new MyListner();

                               

                                MyDelegate dg = new MyDelegate(MyArrayList.Add);

                               

                                m1.checkingMyArrayList(dg);

                                }

               

                //observe the delegate parameter

                public void CheckingArrayList(MyDelegate my_id)

                {

                                for(int i=0; i<ID_Val.Length; i++)

                                {

                                                if(my_id(ID_Val[i]) == true)

                                                {

                                                                j++;

                                                                console.WriteLine("Number of Digits of your VU ID added : "+(j));       

                                                                }

                                                               

                                                }

                                }

                }

}

Comments

Popular posts from this blog

MGMT 627 Assignment Solution Idea

MGT501 - Human Resource Management Assignment No.1 Fall 2020

CS101 Assignment no 2