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(" ");
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            // create a list of department in the company
            List <Department> departments = new List <Department>();

            // create some departments and add them to the list of departments
            HumanResourcesDept HR = new HumanResourcesDept("HR", "Mr. Safewords", 15);

            departments.Add(HR);

            MarketingDept Marketing = new MarketingDept("Marketing", "Mr. Overshare", 20);

            departments.Add(Marketing);

            ITDept IT = new ITDept("IT", "Mr. Configuration", 5);

            departments.Add(IT);

            // use methdos on each department to add policies, plans and computers
            HR.AddPolicy("Hiring", "You can only hire people who say positive words.");
            HR.AddPolicy("Firing", "HR can fire anyone who make someone else feel uncomfortable.");

            Marketing.AddPlan("Social Media", "We will do hourly posts on all social media channels sharing how positive our company culture is and how happy all of our employees are.");
            Marketing.AddPlan("Print Media", "We will purchase full page ads in all local magazines explaining that we are the happiest place to work.");

            IT.AddComputer("Computer1", "HR desk 1");
            IT.AddComputer("Computer2", "HR desk 2");
            IT.AddComputer("Computer3", "Marketing couch 1");
            IT.AddComputer("Computer4", "Marketing loveseat 2");
            IT.AddComputer("Computer5", "IT cube 1");
            IT.AddComputer("Computer6", "IT cube 2");
            IT.AddComputer("Computer7", "IT cube 3");

            // print the list of plans, policies and computers to the console
            HR.ListPolicies();
            Marketing.ListPlans();
            IT.ListComputers();

            // loop through all the departments and print their info to console
            foreach (Department dept in departments)
            {
                Console.WriteLine($"{dept.ToString()}");
            }

            // set a default budget for all departments
            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.
            foreach (Department d in departments)
            {
                d.SetBudget(baseBudget);
                Console.WriteLine($" {d.ToString()}");
            }


            // create some employees using the Employee class
            Employee             Gary    = new Employee("Gary", "Force");
            Employee             Steve   = new Employee("Steve", "Henry");
            Employee             Peter   = new Employee("Peter", "Haps");
            HRDayShiftEmployee   Rebecca = new HRDayShiftEmployee("Rebecca", "Smith", "8-5", 3);
            HRDayShiftEmployee   Lisa    = new HRDayShiftEmployee("Lisa", "Pit", "8-5", 3);
            HRNightShiftEmployee Forest  = new HRNightShiftEmployee("Forest", "Gump", "5-12", 1);
            Employee             Hal     = new Employee("Hal", "Dab");
            Employee             Richard = new Employee("Richard", "Phillipe");
            Employee             Ginny   = new Employee("Ginny", "Gump");

            // Add employees to the department class that they work in
            IT.AddEmployee(Gary);
            IT.AddEmployee(Steve);
            IT.AddEmployee(Peter);

            HR.AddEmployee(Rebecca);
            HR.AddEmployee(Lisa);
            HR.AddEmployee(Forest);

            Marketing.AddEmployee(Hal);
            Marketing.AddEmployee(Richard);
            Marketing.AddEmployee(Ginny);


            // create a list of lunch companions
            List <Employee> lunchCompanions = new List <Employee>
            {
                Steve, Peter, Rebecca, Lisa, Hal
            };

            // send Gary to go eat a bunch of things
            Gary.eat();
            Gary.eat("pizza");
            Gary.eat(lunchCompanions);
            Gary.eat("pasta", lunchCompanions);



            // Print each department and it's employees to the console
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine($"Department: {HR.Name}");
            foreach (Employee emp in HR.Employees)
            {
                Console.WriteLine(emp);
            }
            Console.WriteLine();

            foreach (Employee emp in IT.Employees)
            {
                Console.WriteLine(emp);
            }
            Console.WriteLine();

            // Console.WriteLine($"Department: {IT.Name}");
            // foreach (Employee emp in IT.Employees)
            // {
            //     Console.WriteLine($"    {emp.Name}");
            // }
            // Console.WriteLine();

            // Console.WriteLine($"Department: {Marketing.Name}");
            // foreach (Employee emp in Marketing.Employees)
            // {
            //     Console.WriteLine($"    {emp.Name}");
            // }
            // Console.WriteLine();
        }
        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)}");
            }
        }