Exemple #1
0
        public static void Main()
        {
            List <Department> departments = new List <Department>();

            Marketing marketingDept = new Marketing("Marketing", "Jay Bob", 14);

            marketingDept.addMarketingIdea("botNet", "buy bots and flood the internet with our product");
            marketingDept.SetBudget(marketingDept.baseBudget);
            departments.Add(marketingDept);


            CustomerService customerServiceDept = new CustomerService("Customer Service", "Dwayne The Rock Johnson", 3);

            customerServiceDept.addScript("Customer Retention", "Please do not quit our service you are the best customer we have ever had and we love you like we love out pet pig Harold");
            customerServiceDept.SetBudget(customerServiceDept.baseBudget);
            departments.Add(customerServiceDept);
            foreach (Department d in departments)
            {
                Console.WriteLine($"{d.departmentName}:");
                Console.WriteLine($"Budget:{d.budget}");
                Console.WriteLine(" ");
            }

            Employee jayBob          = new Employee("Jay", "Bob");
            Employee joeSchmoe       = new Employee("Joe", "Schmoe");
            Employee danSchman       = new Employee("Dan", "Schman");
            Employee harrisBuchannon = new Employee("Harris", "Buchannon");
            Employee toddFellows     = new Employee("Todd", "Fellows");
            Employee ronaldCools     = new Employee("Ronald", "Cools");

            List <Employee> Employees = new List <Employee>()
            {
                jayBob,
                joeSchmoe,
                danSchman,
                harrisBuchannon,
                toddFellows,
                ronaldCools
            };

            string jaysLunchSpot = jayBob.eat();

            joeSchmoe.eat("Fried Veggies");
            toddFellows.eat(Employees);
            ronaldCools.eat("Mega Combo Deluxe", Employees);

            Console.WriteLine(" ");

            HandicapEmployee BartPhillips  = new HandicapEmployee("Bart", "Phillips");
            HandicapEmployee ToddJefferies = new HandicapEmployee("Todd", "Jefferies");
            SummerEmployee   TiffanyLewis  = new SummerEmployee("Tiffany", "Lewis");
            DayEmployee      AndreaSlovjic = new DayEmployee("Andrea", "Slovjic");
            NightEmployee    JesseFortana  = new NightEmployee("Jesse", "Fortana");
            SummerEmployee   PipBopkins    = new SummerEmployee("Pip", "Bopkins");
            NightEmployee    LilJoe        = new NightEmployee("Lil", "Joe");
            DayEmployee      MarthaBudglet = new DayEmployee("Martha", "Budglet");

            marketingDept.AddEmployee(BartPhillips);
            marketingDept.AddEmployee(TiffanyLewis);
            marketingDept.AddEmployee(AndreaSlovjic);
            marketingDept.AddEmployee(JesseFortana);
            customerServiceDept.AddEmployee(ToddJefferies);
            customerServiceDept.AddEmployee(PipBopkins);
            customerServiceDept.AddEmployee(LilJoe);
            customerServiceDept.AddEmployee(MarthaBudglet);
            marketingDept.AddEmployee(harrisBuchannon);
            marketingDept.AddEmployee(danSchman);
            customerServiceDept.AddEmployee(toddFellows);
            customerServiceDept.AddEmployee(jayBob);

            foreach (Department d in departments)
            {
                Console.WriteLine($"{d.departmentName}:");
                List <Employee> _employees = d.Employees;
                foreach (Employee employee in _employees)
                {
                    string employeeInfo = $"{employee.firstName} {employee.lastName}";
                    var    hello        = employee.GetType();
                    if (employee.GetType() == typeof(bangazon.HandicapEmployee))
                    {
                        employeeInfo += " is currently handicap with a broken arm.";
                    }
                    else if (employee.GetType() == typeof(bangazon.NightEmployee))
                    {
                        employeeInfo += " works the night shift.";
                    }
                    else if (employee.GetType() == typeof(bangazon.DayEmployee))
                    {
                        employeeInfo += " works the day shift.";
                    }
                    else if (employee.GetType() == typeof(bangazon.SummerEmployee))
                    {
                        employeeInfo += " only works in the summer";
                    }
                    else
                    {
                        employeeInfo += " is a regular full time employee.";
                    }
                    Console.WriteLine(employeeInfo);
                }
                Console.WriteLine(" ");
            }
        }
        static void Main(string[] args)
        {
            List <Department> departments = new List <Department>();

            HumanResources hr        = new HumanResources("HR", "Bob", 5);
            InfoTech       it        = new InfoTech("IT", "John", 3);
            Marketing      marketing = new Marketing("Marketing", "Anna", 10);


            departments.Add(hr);
            departments.Add(it);
            departments.Add(marketing);

            //methods of each department
            // hr.AddPolicy("Smoking", "No smoking inside the building");
            // it.AddHardware("Marketing", "laptop");
            // marketing.AddMaterial("Brochures", 100);

            // marketing.UseMaterial("Flyers", 30);
            // marketing.UseMaterial("Brochures", 25);

            // sets base budget
            double baseBudget = 75000.00;

            //creates new employees
            Employee            bob     = new Employee("Bob", "Jones");
            Employee            jessica = new Employee("Jessica", "Doe");
            MarketingPTEmployee george  = new MarketingPTEmployee("George", "Lane");
            HREmployee          fred    = new HREmployee("Fred", "Dark");

            //adds employees that bob eats lunch with to bob's companion list
            bob.companions.Add(jessica);
            bob.companions.Add(george);

            // bob.eat("burgers", bob.companions);

            fred.Salary = 20;
            Console.WriteLine("fred salary: $" + fred.Salary);

            george.HourlyRate = 13;
            Console.WriteLine("george weekly pay: $" + george.PayForHours(20));


            hr.AddEmployee(fred);
            marketing.AddEmployee(jessica);
            hr.AddEmployee(bob);
            it.AddEmployee(george);


            foreach (Department d in departments)
            {
                Console.WriteLine($"Department: {d.DeptName}");
                foreach (Employee e in d.EmployeeList)
                {
                    Console.WriteLine($"    {e.FullName}");
                }
            }

            foreach (Department d in departments)
            {
                d.SetBudget(baseBudget);
                Console.WriteLine($"{d.toString()}");
            }
        }