Пример #1
0
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            // Insert your tests here...
            var    allEmployees = new List <Employee>();
            Worker worker1      = new Worker("Bill");

            allEmployees.Add(worker1);
            JuniorManager JM  = new JuniorManager("Rodney", 185);
            JuniorManager JM2 = new JuniorManager("Troy", 175);

            allEmployees.Add(JM);
            allEmployees.Add(JM2);
            SeniorManager SM  = new SeniorManager("James", 7);
            SeniorManager SM2 = new SeniorManager("Carlos", 5);

            allEmployees.Add(SM);
            allEmployees.Add(SM2);
            foreach (Employee e in allEmployees)
            {
                Console.WriteLine("{0} has a salary of {1} plus a bonus of {2} if they are a manager {3}", e.GetName(), e.GetSalaryPerMonth(), e.GetBonusPerMonth(), e.IsBonusPaidOut());
            }
            // The LAST line of code should be ABOVE this line
        }
Пример #2
0
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            //Worker FlemmingWorker = new Worker("Flemming");

            //Console.WriteLine($"{FlemmingWorker.GetName()}{FlemmingWorker.GetSalaryPerMonth()}");

            List <Employee> allemployess = new List <Employee>();

            Worker no1 = new Worker("Anne");
            Worker no2 = new Worker("Karen");

            allemployess.Add(no1);
            allemployess.Add(no2);

            JuniorManager Jun1 = new JuniorManager("Sofie", 30000, 5000);
            JuniorManager Jun2 = new JuniorManager("Rikke", 30000, 5000);

            Jun1.SetWorkingHours(160);
            Jun2.SetWorkingHours(200);
            allemployess.Add(Jun1);
            allemployess.Add(Jun2);

            SeniorManager sen1 = new SeniorManager("Lotte", 50000, 10000);
            SeniorManager sen2 = new SeniorManager("Jytte", 50000, 10000);

            sen1.SetPerformancelevel(4);
            sen2.SetPerformancelevel(7);
            allemployess.Add(sen1);
            allemployess.Add(sen2);

            foreach (Employee e in allemployess)
            {
                Console.WriteLine($"Navnet er: {e.GetName()} og lønnen er:{e.GetSalaryPerMonth()} med bonus: {e.IsBonusPaidOut()} ");
            }



            // The LAST line of code should be ABOVE this line
        }
Пример #3
0
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            List <Employee> allEmployees = new List <Employee>();

            Worker w1 = new Worker("Lars", 125, 150);
            Worker w2 = new Worker("Lone", 118, 120);
            Worker w3 = new Worker("Lasse", 95, 40);

            allEmployees.Add(w1);
            allEmployees.Add(w2);
            allEmployees.Add(w3);

            JuniorManager jm1 = new JuniorManager("Sigurd", 25000, 5000);

            jm1.SetWorkedHours(150);
            JuniorManager jm2 = new JuniorManager("Sigrid", 30000, 5000);

            jm2.SetWorkedHours(200);

            allEmployees.Add(jm1);
            allEmployees.Add(jm2);

            SeniorManager sm1 = new SeniorManager("Bent", 40000, 10000);

            sm1.SetPerformaceLevel(2);
            SeniorManager sm2 = new SeniorManager("Bente", 38000, 10000);

            sm2.SetPerformaceLevel(8);
            allEmployees.Add(sm1);
            allEmployees.Add(sm2);

            foreach (Employee e in allEmployees)
            {
                Console.WriteLine($"{e.GetName()} has a monthly salary of {e.GetSalaryPerMonth()}");
                Console.WriteLine();
            }

            // The LAST line of code should be ABOVE this line
        }
Пример #4
0
        public void MyCode()
        {
            // The FIRST line of code should be BELOW this line

            var worker01 = new Worker("Mike", 120, 38);

            Console.WriteLine($"Employee Name: {worker01.GetName()}");
            Console.WriteLine($"Salary: {worker01.GetSalaryPerMonth()}");
            Console.WriteLine($"Bonus paid: {worker01.IsBonusPaidOut()} \n");


            var jmanager01 = new JuniorManager("Small Boss", 1, 181, 5000);

            Console.WriteLine($"Junior Manager Name: {jmanager01.GetName()}");
            Console.WriteLine($"Junior Manager Salary: {jmanager01.GetSalaryPerMonth()}");
            Console.WriteLine($"Bonus Paid: {jmanager01.IsBonusPaidOut()} \n");


            var Smanager01 = new SeniorManager("Big Boss", 2, 180, 50000, 6);

            Console.WriteLine($"Senior Managers Name: {Smanager01.GetName()}");
            Console.WriteLine($"Senior Managers Salary: {Smanager01.GetSalaryPerMonth()}");
            Console.WriteLine($"Bonus Paid: {Smanager01.IsBonusPaidOut()} \n");

            ListofEmployees.Add(worker01);
            ListofEmployees.Add(jmanager01);
            ListofEmployees.Add(Smanager01);

            foreach (var item in ListofEmployees)
            {
                Console.WriteLine($"Name: {item.GetName()}");
                Console.WriteLine($"Salary: {item.GetSalaryPerMonth()}");
                Console.WriteLine($"Bonus Paid: {item.IsBonusPaidOut()} \n");
            }

            // The LAST line of code should be ABOVE this line
        }