static void Main(string[] args)
        {
            PropEmployee[] emp = new PropEmployee[5];
            for (int i = 0; i < emp.Length; i++)
            {
                emp[i] = new PropEmployee();
                Console.WriteLine("Enter employeedid");
                emp[i].EmployeeId = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Enter Employee Name");
                emp[i].EmployeeName = Console.ReadLine().Trim();
                Console.WriteLine("Enter Salary ");
                emp[i].Salary = Convert.ToSingle(Console.ReadLine());
                Console.WriteLine("Enter Deptno");
                emp[i].DepartmentNo = Convert.ToInt32(Console.ReadLine());
            }


            Console.WriteLine("Printing");
            foreach (var item in emp)
            {
                Console.WriteLine(item.EmployeeId);
                Console.WriteLine(item.EmployeeName);
                Console.WriteLine(item.Salary);
                Console.WriteLine(item.NetSalary);
                Console.WriteLine(item.DepartmentNo);
                Console.WriteLine("-------------------");
            }

            Console.WriteLine("");
            int cnt = emp.Count();

            Console.WriteLine("count of employees " + cnt);


            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //Employee emp = new Employee();
            //emp.AcceptData(12, "Jack", "Mumbai", "Developer", 50000f, 10);
            //emp.ShowData();

            //Default Constructor of the class
            PropEmployee emp1 = new PropEmployee();
            //  Console.WriteLine("Enter Employee Id");
            //emp1.EmployeeId = Convert.ToInt32(Console.ReadLine());

            //  Console.WriteLine("Enter employee Name");
            //  emp1.EmployeeName = Console.ReadLine();

            //  Console.WriteLine("Enter Deptno");
            //  emp1.DepartmentNo = Convert.ToInt32(Console.ReadLine());

            //  Console.WriteLine("Enter Salary");
            //  emp1.Salary = Convert.ToSingle(Console.ReadLine());

            //emp1.Password = "******";
            //emp1.NetSalary = 3333;
            //emp1.EmployeeId = 110;//set


            //Console.WriteLine(emp1.EmployeeId);//get
            //Console.WriteLine(emp1.EmployeeName);
            //Console.WriteLine(emp1.DepartmentNo);
            //Console.WriteLine(emp1.Salary);
            //     Console.WriteLine(emp1.NetSalary);
            //Console.WriteLine(emp1.Password);
            //Console.WriteLine("Please enter new password");
            //emp1.NewPassword = Console.ReadLine();


            //Orders o = new Orders(12,"Mobile Phone",40000,1);
            //o.OrderNo = 13;
            //o.OrderDate = new DateTime(2021,04,29);
            //Console.WriteLine(o.OrderAmt);

            //Orders o1 = new Orders(12, "Mobile Phone", 50000, 1);
            //o.OrderNo = 14;
            //o.OrderDate = new DateTime(2021, 04, 29);
            //Console.WriteLine(o1.OrderAmt);

            //Orders o2 = new Orders();
            //Console.WriteLine(o2.OrderAmt);

            //Orders o4 = new Orders(123, "Hard disk",10000f);
            /* Polymorphism---- Overloading Constructors*/
            //Same  name but different number,type and sequence of arguments to the method--- function,void,constructor
            //Orders o = new Orders();

            //PropEmployee e1 = new PropEmployee(3, "Praj");
            //PropEmployee e2 = new PropEmployee(e1);
            //e2.ShowValues();

            //Employee emp = new Employee();
            //emp.CalculateSalary(20000,4.5);
            CustomerPayment payment = new CustomerPayment();

            Console.WriteLine("Enter Payment Mode");
            PaymentMode p = (PaymentMode)Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("You have selected the payment mode  " + p);

            switch (p)
            {
            case PaymentMode.BhimUPi:
                long UPIid = 234324;
                Console.WriteLine("Enter Amt");
                double Amt = Convert.ToDouble(Console.ReadLine());

                payment.Amt = Amt;
                int UPIPin = 3243;
                int OTP    = 434;

                payment.Pay(UPIid, Amt, UPIPin, OTP);
                payment.CustomerDetails();
                break;

            case PaymentMode.NetBanking:

                break;

            case PaymentMode.CardPayment:
                break;

            case PaymentMode.Paytm:
                break;

            case PaymentMode.COD:
                break;

            case PaymentMode.Gpay:
                break;

            case PaymentMode.QR:
                break;

            default:
                break;
            }


            //Student student = new Student();

            Console.Read();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            //BitArray bitArray = new BitArray(2);
            //bitArray.Set(0, true);
            //bitArray.Set(1, false);
            //bool a=bitArray.Get(0);

            //AddElementToList(10000);
            //PrintArrayList();
            //Console.WriteLine(alist.Capacity);
            //bool HasFalseValue = alist.Contains(true);
            //Console.WriteLine(HasFalseValue);
            //object[] objarr = new object[15];
            //alist.CopyTo(objarr);
            //int idx = alist.IndexOf(10000);
            //Console.WriteLine(idx);
            //int[] i1 = new int[] { 400, 500, 600 };
            //alist.InsertRange(1, i1);
            //PrintArrayList();
            //alist.LastIndexOf()
            //ArrayList secondlist = alist.GetRange(1, 3);
            //Console.WriteLine("Get Range");
            //foreach (var item in secondlist)
            //{
            //    Console.WriteLine(item);
            //}
            //alist.SetRange();
            //alist.ToArray();
            //string s = "Hello";

            //char[] chararray = s.ToCharArray();
            //foreach (var item in chararray)
            //{
            //    Console.WriteLine(item);
            //}
            //dotnetperls


            Hashtable t = new Hashtable();

            PropEmployee emp = new PropEmployee()
            {
                EmployeeId   = 1,
                EmployeeName = "Ash",
                DepartmentNo = 10,
                Salary       = 34345
            };

            t.Add(1, emp);
            t.Add("1", "One");
            t.Add(1.1f, 1);
            // t.Add("1", "1");
            //t.Add("1", 1);


            //t.Contains();
            //t.ContainsKey();
            //t.ContainsValue();

            //ICollection values=t.Values;

            //foreach (var item in values)
            //{
            //    Console.WriteLine(item);

            //}

            //ICollection keys=t.Keys;
            //foreach (var item in keys)
            //{
            //    Console.WriteLine(item);
            //}

            //IDictionaryEnumerator ie=t.GetEnumerator();
            //while (ie.MoveNext())
            //{
            //    DictionaryEntry de=ie.Entry;
            //    Console.WriteLine(de.Key);
            //    Console.WriteLine(de.Value);
            //    //object obj=ie.Current;
            //    //Console.WriteLine(obj);

            //}
            //while (ie.MoveNext())
            //{
            //    Console.WriteLine(ie.Key + " "  + ie.Value);
            //}
            //foreach (var item in t)
            //{
            //    Console.WriteLine(t);
            //}
            //Stack s = new Stack();
            //s.Push(11);
            //s.Push(13);
            //s.Pop();//13
            //s.Push(300);
            //s.Peek();//300

            //Stack s1 = new Stack();
            //s1.Push(100);
            //s1.Push(200);
            //    s1.Push(300);
            //s1.Push(400);
            //Stack o1=(Stack)s1.Clone();

            //s1.Pop();
            //Console.WriteLine("Original Stack s1");
            //foreach (var item in s1)
            //{
            //    Console.WriteLine(item);
            //}
            //Console.WriteLine("Cloned stack o1");
            //foreach (object item in o1)
            // {
            //    Console.WriteLine(item);
            //}


            Queue q = new Queue();

            q.Enqueue(1000);
            q.Enqueue(2000);
            q.Enqueue(3000);
            q.Enqueue(4000);
            q.Enqueue(5000);
            q.Enqueue(6000);

            q.Dequeue(); //1000
            q.Peek();    //2000


            SortedList sl = new SortedList();


            Console.ReadLine();
        }