Beispiel #1
0
        static void Main(string[] args)
        {
            Employee     employee = new Employee("Jeff", "Bezos");              //name and surname
            SalaryAndTax employeeFinancialData = employee.Calculate("CEO", 25); //position and years of experience

            employee.ShowData();
            employeeFinancialData.ShowFiancialData();

            Console.ReadKey();
        }
Beispiel #2
0
        public SalaryAndTax Calculate(string position, int yearsOfExperience)
        {
            double salaryIndex = 1 + yearsOfExperience * 0.1;

            string positionInLowerCase = position.Trim().ToLower();

            switch (positionInLowerCase)
            {
            case "ceo":
            {
                SalaryAndTax employeeFinances = new SalaryAndTax(ceoSalary * salaryIndex);
                return(employeeFinances);
            }

            case "financial director":
            {
                SalaryAndTax employeeFinances = new SalaryAndTax(finDirSalary * salaryIndex);
                return(employeeFinances);
            }

            case "project manager":
            {
                SalaryAndTax employeeFinances = new SalaryAndTax(pmSalary * salaryIndex);
                return(employeeFinances);
            }

            case "team lead":
            {
                SalaryAndTax employeeFinances = new SalaryAndTax(teamLeadSalary * salaryIndex);
                return(employeeFinances);
            }

            case "developer":
            {
                SalaryAndTax employeeFinances = new SalaryAndTax(developerSalary * salaryIndex);
                return(employeeFinances);
            }

            default:
            {
                SalaryAndTax employeeFinances = new SalaryAndTax(0);
                return(employeeFinances);
            }
            }
        }