lundi 30 mars 2020

how to get employee using optimal way by id,name ,exp

i have written below code without applying any design pattern,Is anything wrong in this code.

class Employee {
    public int EmployeeID
    { get; set; }
    public int YearOExperience
    { get; set; }
    public int Salary
    { get; set; }
    public string EmploeyeeType
    { get; set; }
}

interface IEmployee {
    List<Employee> getInformation(int id, int exp, int sal);

}

class EmployeeData1 {

    public List<Employee> GetData(int id,int exp , int sal)
        {
            List<Employee> empInfo = new List<Employee> {

    new Employee { EmploeyeeType = "P", EmployeeID = 1, Salary = 20000, YearOExperience= 2  },
     new Employee { EmploeyeeType = "P", EmployeeID = 2, Salary = 20000, YearOExperience= 2  },
      new Employee { EmploeyeeType = "C", EmployeeID = 3, Salary = 20000, YearOExperience= 2  }

        };
            return empInfo;
        }

    }

    static void Main(string[] args) {EmployeeData1 emp = new EmployeeData1();
        emp.getInformation(1, 2, 2000);
    };
}

Here is the assignment: problem

Aucun commentaire:

Enregistrer un commentaire