malek sh

malek sh

  • NA
  • 17
  • 2.3k

How do I transfer the code to pre-existing employees without entering

Dec 18 2021 2:10 PM

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

namespace Question2
{

    public enum TGCEmployeeType { A, B, c, a }; //Declaring ENUM that is used to define the type of employee. 

    public struct TGCEmployeeSalaryInfo //defining struct that will contain the salary information for each employee
    {

        public double points2;//points for c
        public double points1;//points for b

        public double billok;//bill for accept on pays
        public int i;//continue number for bill accepted
        public double average;
        public int bill1;//abill b
        public int bill2;//bill c
        public int bill3;//bill a
        public int bill;//billa
        public double pays3;//pays emoplyee befor Accept a
        public double pays2;//pays emoplyee befor Accept c
        public double pays1;//pays emoplyee befor Accept b
        public double pays;//pays emoplyee befor Accept a
        public double salary3;//salary empolyee a
        public double salary2;//salary empolyee c
        public double salary1;//salary empolyee b
        public double salary;//salary empolyee a

        public double baseSalary;//extra salare for emopyees
        public double Secretary;//worker a
        public double salaryBonus;//extra salare
        public int hours;
        public TGCEmployeeSalaryInfo(TGCEmployeeType emType)    //constructor for salary info sruct
        {
            this.hours = 0;

            this.points2 = 0;//points empolyee c
            this.points1 = 0;//points empolyee b

            this.average = 0;
            this.i = 0;
            this.bill1 = 0;
            this.bill2 = 0;
            this.bill3 = 0;
            this.bill = 0;
            this.billok = 0;
            this.pays3 = 0;
            this.pays2 = 0;
            this.pays1 = 0;
            this.pays = 0;
            this.salary3 = 0;
            this.salary2 = 0;
            this.salary1 = 0;
            this.salary = 0;

            this.bill = 0;
            this.baseSalary = 0;
            this.Secretary = 0;//a
            this.salaryBonus = 0;
            if (emType == (TGCEmployeeType)2)  // employee type is number points b
                this.salaryBonus = points1;
            if (emType == (TGCEmployeeType)3)   // employee type is number points c
                this.salaryBonus = points2;
        }
    }


    class Program
    {
        static void Main(string[] args)
        {


            DateTime myDate = new DateTime(2015, 12, 25, 10, 30, 45);//the date
            int year = myDate.Year; // 2015  
            int month = myDate.Month; //12  
            int day = myDate.Day; // 25  
            int hour = myDate.Hour; // 10  
            int minute = myDate.Minute; // 30  
            int second = myDate.Second; // 45  
            int weekDay = (int)myDate.DayOfWeek; // 5 due to Friday 


            TGCEmployeeArray empArray = new TGCEmployeeArray();     //Creating an empty list of employees.


            int x;
            do
            {

                Console.WriteLine("1 : : opitins " + "\n2 : : employee" + "\n3 : : exit");//display user

                x = int.Parse(Console.ReadLine());


                if (x == 1)
                {

                  

                   // Console.WriteLine("Enter  date in DD/MM/YYYY format");     //and date.
                   // DateTime aDay = DateTime.Parse(Console.ReadLine());//enter date today
                   // Console.WriteLine("today is : ");
                   // Console.WriteLine(aDay.Day);//dat of day 
                   /* if (aDay.Day == 20)//receive all bill accepet in 20 of each month
                    {
                        empArray.billofok();
                    }*/


                    Console.WriteLine("1 add empolyee");          //1-Enter a new employee
                    Console.WriteLine("2 edit empolyee");    //2-Update an existing employee
                    Console.WriteLine("3=Delete employee");             //3-Deleting an employee
                    Console.WriteLine("4=Print employee list");         //4-Printing the employee list
                    Console.WriteLine("5=Print bills");
                    Console.WriteLine("6=print numbers names empolyees"); //print numbers and names empolyees

                    Console.WriteLine("7=print numbers names and average in to day for empolyees");
                    Console.WriteLine("Any other number to Exit");
                    int userChoice = int.Parse(Console.ReadLine());
                    Console.WriteLine();
                    switch (userChoice)
                    {
                        case 1:                                         //If user wishes to enter new employee
                            TGCEmployee emp = CreateNewWorker();        //Asking for employee information by creating a new employee.
                            if (!(empArray.Contains(emp)))              //Checking to see that employee does not exist
                                empArray.Add(emp);                      //If the employee does not exist in the list then we can add it.
                            else
                                Console.WriteLine("Can not add new worker. This worker already exists");
                            break;
                        case 2:                                         //If user wishes to edit an employee
                            EditEmployee(empArray);
                            break;
                        case 3:
                            DeleteEmployee(empArray);                   //if user wishes to delete an employee from the list
                            break;
                        case 4:
                            empArray.Print();
                            break;
                        case 5:
                            empArray.billofok();
                            break;
                        case 6:
                            empArray.numnam();
                            break;
                        case 7:
                            empArray.averagetoday();
                            break;

                        default:
                            x = 0;                        //If user has chosen to exit the system.
                            break;
                    }

                }
                if (x == 2)
                {
                    Console.WriteLine("Enter  date in DD/MM/YYYY format");     //and date.
                    DateTime aDay = DateTime.Parse(Console.ReadLine());//enter date today
                    Console.WriteLine("the week  is : ");//number today
                    Console.WriteLine(aDay.Day);
                    if (aDay.Day == 25)//receive salary and pAYs empolyee in finally week of each a month
                    {
                        empArray.totalmonth();
                    }

                    Console.WriteLine("2= edit empolyee");    //2-Update an existing employee
                    Console.WriteLine("5=print payes empolyee (accept)");// display bill accept
                    Console.WriteLine("1=print number points");
                    Console.WriteLine("3=print pointtype");//type worker a b c 
                    Console.WriteLine("4=total empolyee in month"); // all money  in month
                    Console.WriteLine("6=print bill aceept of empolyer");//known bill accept
                    int userChoice = int.Parse(Console.ReadLine());
                    Console.WriteLine();
                    switch (userChoice)
                    {
                        case 2:                                         //If user wishes to edit an employee 
                            EditEmployee(empArray);
                            break;
                        case 1:
                            empArray.numpoint();
                            break;
                        case 5:
                            empArray.billofok();
                            break;
                        case 3:
                            empArray.pointtype();
                            break;
                        case 4:
                            empArray.totalmonth();
                            break;
                        case 6:
                            empArray.billofok();
                            break;
                    }
                }
            } while (x != 3);//Checking to see if to continue running the system


        }

        static TGCEmployee CreateNewWorker()//Method for creating a new employee.
        {
            TGCEmployee emp;//A new employee consists of the basic information which is
            Console.WriteLine("Enter number empolyee:"); //The empolyee number
            string number = Console.ReadLine();
            Console.WriteLine("Enter  name:"); //The  name
            string name = Console.ReadLine();
            Console.WriteLine("Enter  date in DD/MM/YYYY format");     //and date.
            DateTime bDay = DateTime.Parse(Console.ReadLine());
           

           Console.WriteLine("Is worker 1=Secretary(A), 2=Sales(B), 3=Manager(c), 4=Top Manager(A)?");     //Also asking for the type a or b or c
            TGCEmployeeType workerType = (TGCEmployeeType)int.Parse(Console.ReadLine()) - 1;
            TGCEmployeeSalaryInfo salInfo = GetSalaryInfo(workerType);                          //and the salary information
            emp = new TGCEmployee(number, name, bDay, workerType, salInfo);                      //with all the info can create a new employee
            return emp;
        }

        static void EditEmployee(TGCEmployeeArray employees)                                    //Method for editing an employee and his info   
        {

            TGCEmployee emp = GetEmployeeInfo();                                                //First getting basic info about employee to edit.
            TGCEmployeeSalaryInfo salInfo = new TGCEmployeeSalaryInfo();
            if (employees.Contains(emp))                                                        //Then checking that list has this employee (if not can not edit)
            {
                Console.WriteLine("Has worker position changed? 1=Yes, 2=No");
                int changeType = int.Parse(Console.ReadLine());
                if (changeType == 1)                                                            //If employee type has changed
                {                                                                               //then ask for new type

                    Console.Write("1=edit salary+add pays\n2=edit salary and points");
                    TGCEmployeeType workerType = (TGCEmployeeType)int.Parse(Console.ReadLine()) - 1;
                    salInfo = GetSalaryInfo(workerType);                                         //and then ask for his salary info
                    employees.Replace(emp, workerType, salInfo);                                 //and finally replace the info in the salary list.
                }
                else                                                                             //if type ha not changed   
                {
                    salInfo = GetSalaryInfo(employees.Find(emp));                                //then get only the salary info (without the need for the type)
                    employees.Replace(emp, employees.Find(emp), salInfo);                        //and finally replace the info in the salary list.  
                }
            }
            else
                Console.WriteLine("There is no such employee");

        }

        static void DeleteEmployee(TGCEmployeeArray employees)                                  //Method for deleting an employee from the list
        {
            TGCEmployee emp = GetEmployeeInfo();                                                //First getting the info of the employee to delete
            if (employees.Contains(emp))                                                        //Then checking if he exists in the list
            {
                Console.WriteLine("Deleting employee");
                employees.Remove(emp);                                                          //If he exists then delete him
            }
            else
                Console.WriteLine("There is no such employee");                                 //If he does not exist then tell the user
        }

        static TGCEmployee GetEmployeeInfo()                    //A method for getting the basic information about an employee which includes
        {
            Console.WriteLine("Enter number of the employee");
            string nu = Console.ReadLine();                  //His First name
            Console.WriteLine("Enter name of the employee");
            string na = Console.ReadLine();                   //His last name
            Console.WriteLine("Enter birth date in DD/MM/YYYY format");
            DateTime bDay = DateTime.Parse(Console.ReadLine()); //And his birthday
            TGCEmployee emp = new TGCEmployee(nu, na, bDay);
            return emp;                                         //and then we can create an emplyee object (without adding him to the list)
        }

        static TGCEmployeeSalaryInfo GetSalaryInfo(TGCEmployeeType empType)         //A method for getting the salary info about a certain employee type from the user
        {
            TGCEmployeeSalaryInfo salInfo = new TGCEmployeeSalaryInfo(empType);
            switch (empType)                                                         //A switch to see what the type is so that the correct questions could be asked
            {
                case (TGCEmployeeType)0:
                    Console.WriteLine("Please Enter salary");//salary in month
                    salInfo.salary = double.Parse(Console.ReadLine());

                     Console.WriteLine("Enter number hours work");
                     salInfo.hours = int.Parse(Console.ReadLine());
                      Console.WriteLine("Enter cost one hour");
                      salInfo.salary = int.Parse(Console.ReadLine());
                     Console.WriteLine("Enter add work hours ");
                     int add = int.Parse(Console.ReadLine());
                    Console.Write("enter number bill  if u empolyer enter 0");//for bill really
                    salInfo.bill = int.Parse(Console.ReadLine());
                    Console.Write("what is pays for 1 day only if u empolyer enter 0");//pays empolyee
                    salInfo.pays = int.Parse(Console.ReadLine());
                    break;
                case (TGCEmployeeType)1:                                            //if it is a sales person than ask for base salary, number of sales and bomus per sale
                    Console.WriteLine("Please Enter  Salary");//salary empolyee
                    salInfo.salary1 = double.Parse(Console.ReadLine());
                    Console.Write("enter number bill  if u empolyer enter 0");
                    salInfo.bill1 = int.Parse(Console.ReadLine());
                    Console.Write("what is pays for 1 day only if u empolyer enter 0");
                    salInfo.pays1 = int.Parse(Console.ReadLine());
                    Console.WriteLine("Please Enter number points");//number points a 
                    salInfo.points1 = double.Parse(Console.ReadLine());
                    break;
                case (TGCEmployeeType)2:                                            //if it is a manager than ask for the base salary. The bonus is currently constant as part of the salary info struct  
                    Console.WriteLine("Please Enter  Salary");
                    salInfo.salary2 = double.Parse(Console.ReadLine());
                    Console.Write("enter number bill  if u empolyer enter 0");
                    salInfo.bill2 = int.Parse(Console.ReadLine());
                    Console.Write("what is pays for 1 day only if u empolyer enter 0");
                    salInfo.pays2 = int.Parse(Console.ReadLine());
                    Console.WriteLine("Please Enter number points");
                    salInfo.points2 = double.Parse(Console.ReadLine());
                    break;
                case (TGCEmployeeType)3:                                            //if it is a top manager than ask for the base salary. The bonus is currently constant as part of the salary info struct
                    Console.WriteLine("Please Enter salary");
                    salInfo.salary3 = double.Parse(Console.ReadLine());
                    Console.Write("enter number bill  if u empolyer enter 0");
                    salInfo.bill3 = int.Parse(Console.ReadLine());
                    Console.Write("what is pays for 1 day only if u empolyer enter 0");
                    salInfo.pays3 = int.Parse(Console.ReadLine());
                    break;
            }

            return salInfo;
        }

    }

    class TGCEmployee                                                   //An employee class which includes all the information about an employee, ways to retrieve and set the info, and calculate its salary
    {
        string Number;
        string thename;
        DateTime birthDate;
        TGCEmployeeType employeeType;
        TGCEmployeeSalaryInfo employeeSalaryInfo;

        public TGCEmployee(string num, string name, DateTime bDay)  //first constructor which creates an employee without his salary info and type.
        {
            Number = num;
            thename = name;
            birthDate = bDay;
        }

        public TGCEmployee(string num, string name, DateTime bDay, TGCEmployeeType empType, TGCEmployeeSalaryInfo salInfo) //second constructor which creates an employee with all info
        {
            Number = num;
            thename = name;
            birthDate = bDay;
            employeeType = empType;
            employeeSalaryInfo = salInfo;
        }


        public string empolyeenumber         //property method for getting the first name
        {
            get
            {
                return this.Number;
            }
        }

        public string nameempolyee        //property method for getting the last name
        {
            get
            {
                return this.thename;
            }
        }

        public DateTime BirthDate       //property method for getting the  date
        {
            get
            {
                return this.birthDate;
            }
        }

        public TGCEmployeeType EmployeeType //property method for getting the type of employee or setting it (in case it changed)
        {
            get
            {
                return this.employeeType;
            }

            set
            {
                this.employeeType = value;
            }
        }

        public TGCEmployeeSalaryInfo SalaryInfo //property method for setting new salary information for the employee
        {
            set
            {
                this.employeeSalaryInfo = value;
            }
        }

        public double numpoints()//calculter number points 
        {

            double numpoints = 0;
            switch (employeeType)
            {


                case (TGCEmployeeType)1:        //if employee is a secretary (b) number point
                    numpoints = numpoints + employeeSalaryInfo.points1;


                    break;
                case (TGCEmployeeType)2:        //if employee is a (c) number points
                    numpoints = employeeSalaryInfo.points2;

                    break;

            }
            return numpoints;

        }

        public int numbill()//number bill
        {

            int numbill = 0;
            switch (employeeType)
            {

                case (TGCEmployeeType)0:        //if employee is a secretary than multiply wage per hour by hours worked
                    numbill = employeeSalaryInfo.bill;

                    break;
                case (TGCEmployeeType)1:        //if employee is a secretary than multiply wage per hour by hours worked
                    numbill = employeeSalaryInfo.bill;

                    break;
                case (TGCEmployeeType)2:        //if employee is a secretary than multiply wage per hour by hours worked
                    numbill = employeeSalaryInfo.bill;

                    break;
                case (TGCEmployeeType)3:        //if employee is a secretary than multiply wage per hour by hours worked
                    numbill = employeeSalaryInfo.bill;

                    break;
            }
            return numbill;

        }

        public double totalmonth()//number bill
        {

            double total = 0;
            switch (employeeType)
            {

                case (TGCEmployeeType)0:        //EMPOLYEE take salary end month + payes accept

                    total = employeeSalaryInfo.salary;
                    if (employeeSalaryInfo.pays <= 5000)
                        total = (employeeSalaryInfo.pays) + (employeeSalaryInfo.salary);

                    break;

                case (TGCEmployeeType)1:        //EMPOLYEE take salary end month + payes accept
                    total = employeeSalaryInfo.salary;
                    if (employeeSalaryInfo.pays <= 5000)
                        total = (employeeSalaryInfo.pays) + (employeeSalaryInfo.salary);

                    break;
                case (TGCEmployeeType)2:        //EMPOLYEE take salary end month + payes accept
                    total = employeeSalaryInfo.salary;
                    if (employeeSalaryInfo.pays <= 5000)
                        total = (employeeSalaryInfo.pays) + (employeeSalaryInfo.salary);

                    break;
                case (TGCEmployeeType)3:        //EMPOLYEE take salary end month + payes accept
                    total = employeeSalaryInfo.salary;
                    if (employeeSalaryInfo.pays <= 5000)
                        total = (employeeSalaryInfo.pays) + (employeeSalaryInfo.salary);

                    break;
            }
            return total;

        }


        public int i()// number contunue for accept pays
        {
            int i;
            i = 0;

            switch (employeeType)
            {

                case (TGCEmployeeType)0:        //if employee is A number contunue
                    i = employeeSalaryInfo.i + 1;
                    employeeSalaryInfo.i++;

                    break;
                case (TGCEmployeeType)1:        //if employee is b number contunue
                    i = employeeSalaryInfo.i + 1;
                    employeeSalaryInfo.i++;

                    break;
                case (TGCEmployeeType)2:        //if employee is a c number contunue
                    i = employeeSalaryInfo.i + 1;
                    employeeSalaryInfo.i++;

                    break;

                case (TGCEmployeeType)3:        //if employee is a   number contunue
                    i = employeeSalaryInfo.i + 1;
                    employeeSalaryInfo.i++;

                    break;

            }


            return i;
        }

        public double paymonth()//cacluter pays empolyee in the  month 
        {
            double paymonth = 0;
            switch (employeeType)
            {

                case (TGCEmployeeType)0:        //if pays empolyee a eless or requal 5000 >>>>average =pays/2+ salary/2( /30(day in month))

                    paymonth = (employeeSalaryInfo.salary) + (((employeeSalaryInfo.salary / 2) / 30) * 30);
                    if (employeeSalaryInfo.pays <= 5000)
                    {
                        paymonth = paymonth + (((employeeSalaryInfo.pays / 2) / 30) * 30);

                    }

                    break;
                case (TGCEmployeeType)1:        //if pays empolyee b eless or requal 5000 >>>>average =pays/2+ salary/2( /30(day in month))
                    paymonth = (employeeSalaryInfo.salary1) + (((employeeSalaryInfo.salary1 / 2) / 30) * 30);
                    if (employeeSalaryInfo.pays1 <= 5000)
                    {
                        paymonth = paymonth + (((employeeSalaryInfo.pays1 / 2) / 30) * 30);

                    }


                    break;
                case (TGCEmployeeType)2:    //if pays empolyee c eless or requal 5000 >>>>average =pays/2+ salary/2( /30(day in month))
                    paymonth = (employeeSalaryInfo.salary2) + (((employeeSalaryInfo.salary2 / 2) / 30) * 30);
                    if (employeeSalaryInfo.pays2 <= 5000)
                    {
                        paymonth = paymonth + (((employeeSalaryInfo.pays2 / 2) / 30) * 30);

                    }

                    break;
                case (TGCEmployeeType)3:        //if pays empolyee a eless or requal 5000 >>>>average =pays/2+ salary/2( /30(day in month))
                    paymonth = (employeeSalaryInfo.salary3) + (((employeeSalaryInfo.salary3 / 2) / 30) * 30);
                    if (employeeSalaryInfo.pays3 <= 5000)
                    {
                        paymonth = paymonth + (((employeeSalaryInfo.pays3 / 2) / 30) * 30);

                    }

                    break;
            }

            return paymonth;
        }

        public double avreage()//cacluter average payes aceept from empolyer 
        {


            double average = 0;
            switch (employeeType)
            {

                case (TGCEmployeeType)0:        //if pays empolyee a eless or requal 5000 >>>>average =pays/2+ salary/2( /30(day in month))
                    if (employeeSalaryInfo.pays <= 5000)
                        average = (employeeSalaryInfo.pays / 2) + ((employeeSalaryInfo.salary / 2) / 30);


                    break;
                case (TGCEmployeeType)1:        //if pays empolyee b eless or requal 5000 >>>>average =pays/2+ salary/2( /30(day in month))
                    if (employeeSalaryInfo.pays1 <= 5000)

                        if (employeeSalaryInfo.points1 >= 80)
                            average = (((employeeSalaryInfo.salary1 * 2 / 2) / 360) + (employeeSalaryInfo.pays1 / 2) + ((employeeSalaryInfo.salary1 / 2) / 30)); // base salary  with bess in years >>in day /360
                    if ((employeeSalaryInfo.points1 <= 79) && (employeeSalaryInfo.points1 > 65))
                        average = (((employeeSalaryInfo.salary1 * 1.5 / 2) / 360) + (employeeSalaryInfo.pays1 / 2) + ((employeeSalaryInfo.salary1 / 2) / 30));
                    if ((employeeSalaryInfo.points1 <= 64) && (employeeSalaryInfo.points1 > 50))
                        average = (employeeSalaryInfo.salary1) + (employeeSalaryInfo.pays1 / 2) + ((employeeSalaryInfo.salary1 / 2) / 30);
                    if (employeeSalaryInfo.points1 < 50)
                        average = (employeeSalaryInfo.salary1 * 0) + (employeeSalaryInfo.pays1 / 2) + ((employeeSalaryInfo.salary1 / 2) / 30);


                    break;
                case (TGCEmployeeType)2:        //if pays empolyee c eless or requal 5000 >>>>average =pays/2+ salary/2( /30(day in month))
                    if (employeeSalaryInfo.pays2 <= 5000)

                        if (employeeSalaryInfo.points2 >= 80)
                            average = (((employeeSalaryInfo.salary2 * 2 / 2) / 360) + (employeeSalaryInfo.pays2 / 2) + ((employeeSalaryInfo.salary2 / 2) / 30)); // base salary  with bess in years >>in day /360
                    if ((employeeSalaryInfo.points2 <= 79) && (employeeSalaryInfo.points2 > 65))
                        average = (((employeeSalaryInfo.salary2 * 1.5 / 2) / 360) + (employeeSalaryInfo.pays2 / 2) + ((employeeSalaryInfo.salary2 / 2) / 30));
                    if ((employeeSalaryInfo.points2 <= 64) && (employeeSalaryInfo.points2 > 50))
                        average = (employeeSalaryInfo.salary2) + (employeeSalaryInfo.pays2 / 2) + ((employeeSalaryInfo.salary2 / 2) / 30);
                    if (employeeSalaryInfo.points2 < 50)
                        average = (employeeSalaryInfo.salary2 * 0) + (employeeSalaryInfo.pays2 / 2) + ((employeeSalaryInfo.salary2 / 2) / 30);


                    break;
                case (TGCEmployeeType)3:        //if pays empolyee a eless or requal 5000 >>>>average =pays/2+ salary/2( /30(day in month))
                    if (employeeSalaryInfo.pays <= 5000)
                        average = (employeeSalaryInfo.pays / 2) + ((employeeSalaryInfo.salary / 2) / 30);
                    break;
            }

            return average;
        }


        public double billok()//accept pays
        {
            double billok = 0;
            switch (employeeType)
            {
                case (TGCEmployeeType)0:        //if employee is a <=5000>>>>bill accept
                    if (employeeSalaryInfo.pays <= 5000)
                        billok = billok + employeeSalaryInfo.pays;
                    break;
                case (TGCEmployeeType)1:        //if employee is b <=5000>>>>bill accept
                    if (employeeSalaryInfo.pays <= 5000)
                        billok = billok + employeeSalaryInfo.pays1;
                    break;
                case (TGCEmployeeType)2:        //if employee is c <=5000>>>>bill accept
                    if (employeeSalaryInfo.pays <= 5000)
                        billok = billok + employeeSalaryInfo.pays2;
                    break;
                case (TGCEmployeeType)3:        //if employee is a top manager than add the bonus to the base salary
                    if (employeeSalaryInfo.pays <= 5000)
                        billok = billok + employeeSalaryInfo.pays3;
                    break;
            }
            return billok;
        }
        public double Salary()               // the employee's salary
        {
            double thesalary = 0;
            switch (employeeType)
            {
                case (TGCEmployeeType)0:        //salary empolyee a
                    thesalary = employeeSalaryInfo.salary;

                    break;
                case (TGCEmployeeType)1:        //salary empolyee b

                    thesalary = employeeSalaryInfo.salary1;


                    break;
                case (TGCEmployeeType)2:        //salary empolyee c
                    thesalary = employeeSalaryInfo.salary2;
                    break;
                case (TGCEmployeeType)3:        //salary empolyee a
                    thesalary = employeeSalaryInfo.salary3;
                    break;
            }

            return thesalary;
        }

        public double CalcSalary()               //method for calculating the employee's salary with extra in year
        {
            double thesalary = 0;
            switch (employeeType)
            {

                case (TGCEmployeeType)1:        //if employee is a sales person than multiply number of sales by bonus per sale and add that to the base salary
                    if (employeeSalaryInfo.points1 >= 80)
                        thesalary = employeeSalaryInfo.salary1 * 2;// base salary  in years
                    if ((employeeSalaryInfo.points1 <= 79) && (employeeSalaryInfo.points1 > 65))
                        thesalary = employeeSalaryInfo.salary1 * 1.5;
                    if ((employeeSalaryInfo.points1 <= 64) && (employeeSalaryInfo.points1 > 50))
                        thesalary = employeeSalaryInfo.salary1;
                    if (employeeSalaryInfo.points1 < 50)
                        thesalary = employeeSalaryInfo.salary1 * 0;
                    break;
                case (TGCEmployeeType)2:        //if employee is(b) than add the bonus to the base salary
                    if (employeeSalaryInfo.points2 >= 80)
                        thesalary = employeeSalaryInfo.salary2 * 2;// base salary  in years
                    if ((employeeSalaryInfo.points2 <= 79) && (employeeSalaryInfo.points2 > 65))
                        thesalary = employeeSalaryInfo.salary2 * 1.5;
                    if ((employeeSalaryInfo.points2 <= 64) && (employeeSalaryInfo.points2 > 50))
                        thesalary = employeeSalaryInfo.salary2;
                    if (employeeSalaryInfo.points2 < 50)
                        thesalary = employeeSalaryInfo.salary2 * 0;
                    break;
                case (TGCEmployeeType)3:        //if employee is a top manager than add the bonus to the base salary

                    break;
            }

            return thesalary;
        }


    }
    

    class TGCEmployeeArray                      //A class for dealing with a list of employees
    {
        private ArrayList employees;            //class is based on an array list

        public TGCEmployeeArray()               //and constructor just creates an empty array list
        {
            employees = new ArrayList();
        }

        public void Add(TGCEmployee emp)        //when adding an employee to the list it is 
        {
            employees.Add(emp);                 //just added to the array list

        }

        public bool Contains(TGCEmployee emp)  //a method for checking if an employee is contained in the list.
        {
            foreach (TGCEmployee e in employees)    //going through the list and if the same employee (same first name, last name and birthday) is found than he is contained in the list
                if ((emp.empolyeenumber.ToLower() == e.empolyeenumber.ToLower()) && (emp.nameempolyee.ToLower() == e.nameempolyee.ToLower()) && (emp.BirthDate == e.BirthDate))
                    return true;

            return false;
        }

        public void Remove(TGCEmployee emp)   //a method for removing an employee from the list.
        {
            foreach (TGCEmployee e in employees)    //if same employee (same first name, same last name and birthdate) is found in the list
                if ((emp.empolyeenumber.ToLower() == e.empolyeenumber.ToLower()) && (emp.nameempolyee.ToLower() == e.nameempolyee.ToLower()) && (emp.BirthDate == e.BirthDate))
                {
                    employees.Remove(e);            //then it can be removed.
                    break;
                }


        }

        public TGCEmployeeType Find(TGCEmployee emp)    //a method for finding an employee in the list and returning his employee type
        {
            foreach (TGCEmployee e in employees)
                if ((emp.empolyeenumber.ToLower() == e.empolyeenumber.ToLower()) && (emp.nameempolyee.ToLower() == e.nameempolyee.ToLower()) && (emp.BirthDate == e.BirthDate))
                    return e.EmployeeType;

            return (TGCEmployeeType)0;

        }

        public void Replace(TGCEmployee emp, TGCEmployeeType emType, TGCEmployeeSalaryInfo salInfo) //a method for replacing an employees info. only type and salary info could be replaced
        {
            foreach (TGCEmployee e in employees)    //finding employee to replace
                if ((emp.empolyeenumber.ToLower() == e.empolyeenumber.ToLower()) && (emp.nameempolyee.ToLower() == e.nameempolyee.ToLower()) && (emp.BirthDate == e.BirthDate))
                {
                    e.EmployeeType = emType;        //replacing type
                    e.SalaryInfo = salInfo;         //replacing salary info
                    break;
                }

        }
        public void pointtype()//names empolyees and points and type b
        {
            Console.WriteLine("number     \tname      \tnumpoints\ttype emp ");
            Console.WriteLine("-----------\t----------\t----------\t----------");

            foreach (TGCEmployee e in employees)
                Console.WriteLine("{0}\t{1}\t{2}\t{3}", e.empolyeenumber.PadRight(11), e.nameempolyee.PadRight(10), e.numpoints().ToString().PadRight(9), e.EmployeeType.ToString().PadRight(9));
            ;
        }
        public void numpoint()     //a method for printing all employees in the list icluding name,  type and points.number,number
        {
            Console.WriteLine("number     \tname      \tnumberoints");
            Console.WriteLine("-----------\t----------\t----------");

            foreach (TGCEmployee e in employees)
                Console.WriteLine("{0}\t{1}\t{2}", e.empolyeenumber.PadRight(11), e.nameempolyee.PadRight(10), e.numpoints().ToString().PadRight(9));
            ;
        }
        public void numnam()    //display numbers and names empolyees             
        {
            Console.WriteLine("number     \tname      ");
            Console.WriteLine("-----------\t----------");

            foreach (TGCEmployee e in employees)
                Console.WriteLine("{0}\t{1}", e.empolyeenumber.PadRight(11), e.nameempolyee.PadRight(10));
            ;
        }


        public void totalmonth()    //display total money in end month                 
        {
            Console.WriteLine("number     \tname      \ttotal in month ");
            Console.WriteLine("-----------\t----------\t----------");

            foreach (TGCEmployee e in employees)
                Console.WriteLine("{0}\t{1}\t{2}", e.empolyeenumber.PadRight(11), e.nameempolyee.PadRight(10), e.totalmonth().ToString());
            ;
        }


        public void billofok() //a method for printing all employees in the list icluding number ,name,bill accepted,number bill really ,number contunue
        {
            Console.WriteLine("number     \tname      \tpay accept\tnum bill   \tcon num ");
            Console.WriteLine("-----------\t----------\t----------\t-----------\t--------");

            foreach (TGCEmployee e in employees)
                Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", e.empolyeenumber.PadRight(11), e.nameempolyee.PadRight(10), e.billok().ToString().PadRight(9), e.numbill().ToString().PadLeft(8), e.i().ToString());
            ;
        }

        public void averagetoday() //print numbers and names empolyees and average in today
        {
            Console.WriteLine("number     \tname      \taverage   ");
            Console.WriteLine("-----------\t----------\t----------");

            foreach (TGCEmployee e in employees)
                Console.WriteLine("{0}\t{1}\t{2}", e.empolyeenumber.PadRight(11), e.nameempolyee.PadRight(10), e.avreage().ToString().PadRight(9));

        }


        public void Print() //a method for printing all employees in the list icluding name, date, type (A,B,C) AND salary,
        {
            Console.WriteLine("number     \tname      \t      Date\tWorker Type\tbasesalar ");
            Console.WriteLine("-----------\t----------\t----------\t-----------\t----------");

            foreach (TGCEmployee e in employees)
                Console.WriteLine("{0}\t{1}\t{2}\t{3}\t{4}", e.empolyeenumber.PadRight(11), e.nameempolyee.PadRight(10), e.BirthDate.ToShortDateString(), e.EmployeeType.ToString().PadRight(9), e.CalcSalary().ToString().PadRight(8));
            Console.WriteLine("average   \tpaye inmonth");
            Console.WriteLine("----------\t------------");
            foreach (TGCEmployee e in employees)
                Console.WriteLine("{0}\t{1}", e.avreage().ToString().PadRight(11), e.paymonth().ToString().PadRight(10));
            Console.WriteLine("number     \tname      \tsalary");
            Console.WriteLine("-----------\t----------\t------");
            foreach (TGCEmployee e in employees)
                Console.WriteLine("{0}\t{1}\t{2}", e.empolyeenumber.PadRight(11), e.nameempolyee.PadRight(10), e.Salary());

            Console.WriteLine();


        }


    }
}