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

            // Create some instances
            HumanResources hr = new HumanResources("HR", "Amy Schumer", 2);

            hr.AddPolicy("Don't burp!", "Please don't do that in the office");
            hr.setBudget(2000);

            Sales sales = new Sales("Sales", "Ryan McPherson", 195);

            sales.AddPolicy("Sell no matter what.", "Do anything you have to do.");
            sales.setBudget(100000);

            Operations operations = new Operations("Operations", "Don Young", 2345);

            operations.AddPolicy("Build things that dont break.", "It's your job.");
            operations.setBudget(30);

            // Add derived departments to the list
            departments.Add(hr);
            departments.Add(sales);
            departments.Add(operations);

            // Iterate over all items in the list and output a string
            // representation of the class
            foreach (Department d in departments)
            {
                Console.WriteLine($"Department: {d._name}, Supervisor: {d._supervisor}, Employee Count: {d._employee_count}");
            }
        }
        static void Main(string[] args)
        {
            List <Department> departments = new List <Department>();

            double baseBudget = 75000.00;

            // Create some instances
            HumanResources        hr  = new HumanResources("HR", "Jack Reacher", 2);
            InformationTechnology it  = new InformationTechnology("IT", "John Wick", 12);
            Marketing             mkt = new Marketing("Marketing", "John McClane", 12);
            Sales sls = new Sales("Sales", "Brian Mills", 22);

            // Add derived departments to the list
            departments.Add(hr);
            departments.Add(it);
            departments.Add(mkt);
            departments.Add(sls);

            // Iterate over all items in the list and output a string
            // representation of the class
            foreach (Department d in departments)
            {
                d.SetBudget(baseBudget);
                Console.WriteLine($"{d.toString()}");
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            HumanResources Humanz = new HumanResources("Bangazon", "Steve", 3);

            Humanz.AddPolicy("first policy", "super cool");
            Marketing Marketz = new Marketing("Market Team", "Kevin", 1);

            Marketz.AddPolicy("Marketing policy", "Very neat!");
            Finance Financing = new Finance("Finance department", "Jared", 2);

            Financing.AddPolicy("Jared's Mandatory policy", "This is mandatory");

            List <Department> DepartmentList = new List <Department>();

            DepartmentList.Add(Humanz);
            DepartmentList.Add(Marketz);
            DepartmentList.Add(Financing);

            foreach (Department D in DepartmentList)
            {
                Console.WriteLine($"{D.ToString()}");
            }

            string MeetFunctionHr = Humanz.Meet();

            Console.WriteLine("Human Resources: {0}", MeetFunctionHr);

            string MeetFunctionMarketing = Marketz.Meet();

            Console.WriteLine("Marketing: {0}", MeetFunctionMarketing);

            string MeetFunctionFinance = Financing.Meet();

            Console.WriteLine("Finance: {0}", MeetFunctionFinance);
        }
예제 #4
0
        static void Main(string[] args)
        {
            List <Department> departments = new List <Department>();

            // Create some instances
            HumanResources hr    = new HumanResources("HR", "Amy Schumer", 2);
            IT             it    = new IT("IT", "Lance Carrington", 2, 5);
            Sales          sales = new Sales("Sales", "Carly Fiorini", 25, 5);

            hr.AddPolicy("Vacaction", "Unlimited vacation for all!");
            it.Backup();
            sales.ThrowDart();

            // Add derived departments to the list
            departments.Add(hr);
            departments.Add(it);
            departments.Add(sales);

            double baseBudget = 75000.00;

            // Some departments get the base $75,000.00 budget, but others
            // will be adjusted up or down depending on the logic you wrote
            // in each class.

            // Iterate over all items in the list and output a string
            // representation of the class
            foreach (Department d in departments)
            {
                d.SetBudget(baseBudget);
                Console.WriteLine($"{d.ToString()}");
                d.Meet();
            }



            System.Console.WriteLine(@"
***********************************************
The eating employee...");

            List <Employee> companions = new List <Employee>()
            {
                new Employee("Jeff", "Lebowski"),
                new Employee("Walter", "Socheck"),
                new Employee("Dude", "Duderino if you are not into the brevity thing")
            };

            Employee krys = new Employee("Krys", "Mathis");

            krys.eat();
            krys.eat("Bananas");
            krys.eat(companions);
            krys.eat("BBQ", companions);


            // Final Output
            System.Console.WriteLine(@"
***********************************************
Employed employees...");
            hr.minAccessLevelToEnter = 5;
            hr.AddEmployee(new HumanResourceEmployees("Andri", "Alexandrou"));
            hr.AddEmployee(new HumanResourceEmployees("Wayne", "Hutchinson"));
            hr.AddEmployee(new HumanResourceEmployees("Sephora", "Rodriguez"));
            HumanResourceEmployees Matt = new HumanResourceEmployees("Matt", "Qualls");

            Matt.AddHandicap("Chronic Migraines");
            hr.AddEmployee(Matt);


            Console.WriteLine($"\nDepartment: {hr.Name} Access Level: {hr.minAccessLevelToEnter} Required");

            foreach (HumanResourceEmployees emp in hr.Employees)
            {
                Console.WriteLine($"{emp} {String.Join(',',emp.Handicaps)}");
            }

            it.minAccessLevelToEnter = 8;
            Console.WriteLine($"{Environment.NewLine}Department: {it.Name} Access Level: {it.minAccessLevelToEnter} Required");
            it.AddEmployee(new ITEmployee("Caitlin", "Stein", "Day", 8));
            it.AddEmployee(new ITEmployee(
                               firstName: "Ray",
                               lastName: "Tenay",
                               shift: "Night",
                               accessLevel: 7
                               ));

            foreach (ITEmployee emp in it.Employees)
            {
                Console.WriteLine($"{emp} Shift: {emp.Shift} ValidAccess: {it.validAccess(emp.AccessLevel)}");
            }
        }
예제 #5
0
        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()}");
            }
        }