Exemplo n.º 1
0
        static void Main(string[] args)
        {
            const double baseBudget = 75000.00;

            // Create some instances
            HumanResources hr01 = new HumanResources("HR 1", "Toby Flenderson", 2, "Dunder Mifflin");
            HumanResources hr02 = new HumanResources("HR 2", "Jack Frost", 13, "South Pole");
            Accounting     ac01 = new Accounting("Accounting", "Angela Martin", 10, "Dunder Mifflin");
            Sales          sa01 = new Sales("Sales 1", "Michael Scott", 50, "Dunder Mifflin");

            hr01.printDetails();
            hr02.printDetails();
            ac01.printDetails();
            sa01.printDetails();


            hr01.AddPolicy("Terminating Employees", "How to give people the shaft.");
            hr01.AddPolicy("Selling Out People", "How to screw people over.");
            hr01.AddPolicy("Bankrupting the System", "How to steal like a politician.");
            hr01.printPolicies();

            sa01.AddSale("Dwight Schrute", 58975);
            sa01.AddSale("Phyllis Lapin", 48502);
            sa01.AddSale("Stanley Hudson", 1254871);
            sa01.printSalesStats();

            ac01.AddBudget("Kevin Malone", -13);
            ac01.AddBudget("Oscar Gutierrez", 4858502);
            ac01.AddBudget("Angela Martin", 101254871);
            ac01.printBudgetStats();


            // Add derived departments to the list
            List <Department> departmentsList = new List <Department>();

            departmentsList.Add(hr01);
            departmentsList.Add(hr02);
            departmentsList.Add(ac01);
            departmentsList.Add(sa01);

            foreach (Department d in departmentsList)
            {
                d.SetBudget(baseBudget);
            }

            Console.WriteLine("\nToString() method on each list object:");
            foreach (Department d in departmentsList)
            {
                Console.WriteLine($"{d.ToString()}");
            }

            // Employee E01 = new Employee("Ken", "Lewis");
            // Console.WriteLine("\n");
            // E01.printEmployee();
            // Console.WriteLine("\n");

            // Console.WriteLine("\n------------------------------------");
            // Console.WriteLine("\n------------------------------------");

            // HumanResourcesEmployee E02 = new HumanResourcesEmployee("Ted", "Nugent", "fT", 24.50);

            // E02.printEmployee();
            // Console.WriteLine("\n");
            // HumanResourcesEmployee E03 = new HumanResourcesEmployee();
            // E03.printEmployee();

            // Console.WriteLine("\n------------------------------------");
            // Console.WriteLine("\n------------------------------------");

            // SalesEmployee E04 = new SalesEmployee("Teddy", "Nugenty", "pt", 24.50);
            // E04.printEmployee();
            // Console.WriteLine("\n");
            // SalesEmployee E05 = new SalesEmployee();
            // E05.printEmployee();

            // Console.WriteLine("\n------------------------------------");
            // Console.WriteLine("\n------------------------------------");

            // AccountingEmployee E06 = new AccountingEmployee("Teddyyy", "Nugent", "FT", 2400.50);
            // E06.printEmployee();
            // Console.WriteLine("\n");
            // AccountingEmployee E07 = new AccountingEmployee();
            // E07.printEmployee();

            Console.WriteLine("\n------------------------------------");
            Console.WriteLine("------------------------------------");

            Employee hre01 = new Employee("Ted", "Nugent");
            Employee hre02 = new Employee("Eddy", "Van Halen");
            Employee hre03 = new Employee("Alice", "Cooper");

            Employee sae01 = new Employee("Johnny", "Appleseed");
            Employee sae02 = new Employee("Jack", "Ripper");
            Employee sae03 = new Employee("George", "Washington");

            Employee ace01 = new Employee("Theodore", "huxtable");
            Employee ace02 = new Employee("Peter", "Griffin");
            Employee ace03 = new Employee("Glen", "Quigmire");

            hr01.AddEmployee(hre01);
            hr01.AddEmployee(hre02);
            hr01.AddEmployee(hre03);

            sa01.AddEmployee(sae01);
            sa01.AddEmployee(sae02);
            sa01.AddEmployee(sae03);

            ac01.AddEmployee(ace01);
            ac01.AddEmployee(ace02);
            ac01.AddEmployee(ace03);


            hr01.printEmployeeList();
            sa01.printEmployeeList();
            ac01.printEmployeeList();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            var sales = new Sales
            {
                Name           = "Sales",
                Supervisor     = "Joey",
                Employee_Count = 13,
                NumberOfDeals  = 50,
                AreTools       = false
            };

            var developers = new IT
            {
                Name              = "Engineering",
                Supervisor        = "Jason",
                Employee_Count    = 11,
                TechStack         = "Python/React",
                AreLazy           = false,
                SecurityClearance = true,
                OnCall            = true
            };

            var humanresources = new HR
            {
                Name           = "Human Resources",
                Supervisor     = "Christine",
                Employee_Count = 3,
                Grievances     = 4,
                Rules          = 15
            };

            var support = new BasicDepartment
            {
                Name           = "Support",
                Supervisor     = "Benton",
                Employee_Count = 16
            };

            var marketing = new BasicDepartment
            {
                Name           = "Marketing",
                Supervisor     = "Colby",
                Employee_Count = 16
            };

            var qa = new IT
            {
                Name              = "Quality Automation",
                Supervisor        = "Josh",
                Employee_Count    = 4,
                TechStack         = "Javascript/React",
                AreLazy           = true,
                SecurityClearance = false,
                OnCall            = false
            };

            var Departments = new List <Department>
            {
                sales,
                developers,
                humanresources,
                support,
                marketing,
                qa
            };

            qa.AddEmployee(new Employee {
                FirstName = "Brian", LastName = "Fuzzel"
            });
            qa.AddEmployee(new Employee {
                FirstName = "Brandon", LastName = "Wannamaker"
            });
            qa.AddEmployee(new Employee {
                FirstName = "Josh", LastName = "Cypher"
            });
            qa.AddEmployee(new Employee {
                FirstName = "Megan", LastName = "Heineken"
            });
            sales.AddEmployee(new Employee {
                FirstName = "Jordan", LastName = "Cocklin"
            });
            sales.AddEmployee(new Employee {
                FirstName = "Jordan", LastName = "Pratt"
            });
            sales.AddEmployee(new Employee {
                FirstName = "Joey", LastName = "Davis"
            });
            sales.AddEmployee(new Employee {
                FirstName = "Pete", LastName = "Oliveras"
            });
            marketing.AddEmployee(new Employee {
                FirstName = "Nora", LastName = "Snoddy"
            });
            marketing.AddEmployee(new Employee {
                FirstName = "Christina", LastName = "Brady"
            });
            marketing.AddEmployee(new Employee {
                FirstName = "Greg", LastName = "Frank"
            });
            humanresources.AddEmployee(new Employee {
                FirstName = "Christine", LastName = "McPherson"
            });
            humanresources.AddEmployee(new Employee {
                FirstName = "Priya", LastName = "Pappu"
            });
            support.AddEmployee(new Employee {
                FirstName = "Benton", LastName = "Cummings"
            });
            support.AddEmployee(new Employee {
                FirstName = "Heather", LastName = "Sturm"
            });
            support.AddEmployee(new Employee {
                FirstName = "Ross", LastName = "Cochran"
            });
            support.AddEmployee(new Employee {
                FirstName = "Zach", LastName = "Sharpe"
            });
            developers.AddEmployee(new Employee {
                FirstName = "Courey", LastName = "Elliott"
            });
            developers.AddEmployee(new Employee {
                FirstName = "Seth", LastName = "Buntin"
            });
            developers.AddEmployee(new Employee {
                FirstName = "Kris", LastName = "Plunkett"
            });
            developers.AddEmployee(new Employee {
                FirstName = "Donald", LastName = "Thompson"
            });

            foreach (var department in Departments)
            {
                department.Deparment_Description();
                department.SetBudget(75000);

                switch (department)
                {
                case Sales s:
                    s.SalesGoals();
                    break;

                case HR h:
                    h.ImInTrouble();
                    break;

                case IT i:
                    i.OurDevelopers();
                    i.IsCleared();
                    Console.WriteLine(i.IsOnCall());
                    break;
                }
            }

            foreach (var department in Departments)
            {
                Console.WriteLine($"{department.Name} has the following employees:");
                foreach (var employee in department.Employees)
                {
                    Console.WriteLine($"{employee.FirstName} {employee.LastName}");
                }
            }

            Console.Read();
        }
Exemplo n.º 3
0
        public static void Main()
        {
            var sales = new Sales
            {
                Name           = "Sales",
                Supervisor     = "Mark",
                Employee_Count = 24,
                SalesCompleted = 0,
                MeetingPlace   = "Starbucks"
            };

            var marketing = new Marketing
            {
                Name                    = "Marketing",
                Supervisor              = "Jennifer",
                Employee_Count          = 10,
                FacebookAdCampaignsSold = 12,
                MeetingPlace            = "Panera Bread"
            };

            var it = new IT
            {
                Name           = "IT/Development",
                Supervisor     = "Ringo",
                Employee_Count = 16,
                Skillz         = "C#",
                MeetingPlace   = "Think Tank #1"
            };

            var Departments = new List <Department>
            {
                sales,
                marketing,
                it
            };

            sales.AddEmployee(new Employee {
                FirstName = "John", LastName = "Bonham"
            });
            sales.AddEmployee(new Employee {
                FirstName = "Robert", LastName = "Plant"
            });
            sales.AddEmployee(new Employee {
                FirstName = "Jimmy", LastName = "Page"
            });
            marketing.AddEmployee(new Employee {
                FirstName = "Jordan", LastName = "Pudnick"
            });
            marketing.AddEmployee(new Employee {
                FirstName = "Chad", LastName = "Gilbert"
            });
            marketing.AddEmployee(new Employee {
                FirstName = "Ian", LastName = "Grushka"
            });
            it.AddEmployee(new Employee {
                FirstName = "Paul", LastName = "McCartney"
            });
            it.AddEmployee(new Employee {
                FirstName = "John", LastName = "Lenon"
            });
            it.AddEmployee(new Employee {
                FirstName = "George", LastName = "Harrison"
            });



            foreach (var department in Departments)
            {
                switch (department)
                {
                case Sales s:
                    s.Department_Description();
                    s.SalesGoals();
                    s.SetMeetingPlace();
                    s.SetBudget(55000);
                    s.Commission("commission");
                    break;

                case Marketing m:
                    m.Department_Description();
                    m.FacebookAdCampaigns();
                    m.SetMeetingPlace();
                    m.SetBudget(55000);
                    m.Hourly("hourly");
                    break;

                case IT i:
                    i.Department_Description();
                    i.Developers();
                    i.SetMeetingPlace();
                    i.SetBudget(55000);
                    i.Salary("salary");
                    break;

                default:
                    break;
                }
            }


            foreach (var department in Departments)
            {
                Console.WriteLine($"Department: {department.Name}");
                foreach (var employee in department.Employees)
                {
                    Console.WriteLine($"{employee.FirstName} {employee.LastName}");
                }
            }



            Console.ReadLine();
        }