Пример #1
0
    public static void Main(string[] args)
    {
        CommissionEmployee employeeC = new CommissionEmployee();

        employeeC.setData("Terry", "Harbos", 100523153, 300.25, 0.08);
        Console.WriteLine(employeeC.ToString());
        Console.WriteLine("Earnings: " + employeeC.Earnings());

        BasePlusComissionEmployee employeeB = new BasePlusComissionEmployee("Terry", "Harbos", 100523153, 300.25, 0.10, 25.00);

        Console.WriteLine("Earnings: " + employeeB.Earnings());
    }
Пример #2
0
        static void Main(string[] args)
        {
            //toast er gud udhsaoiudjiuashdoias
            Console.WriteLine("Hourley:");
            Console.Writeline("Kagemand 45");
            HourlyEmployee mads = new HourlyEmployee("Mads", "Rasmussen", 10, 100M);
            HourlyEmployee emil = new HourlyEmployee("Emil", "Cordsen", 168, 200000);
            HourlyEmployee jack = new HourlyEmployee("jack", "Thomsen", 127, 20000);

            Console.WriteLine(mads.ToString() + "\n");

            Console.WriteLine(emil.ToString() + "\n");

            Console.WriteLine(jack.ToString() + "\n");

            Console.WriteLine("Fixed:");
            FixedEmployee morten = new FixedEmployee("Morten", "Hejn", 1000);
            FixedEmployee daniel = new FixedEmployee("Daniel", "Giversen", 20000);
            FixedEmployee emil2  = new FixedEmployee("Emil", "Cordsen", 200000);

            Console.WriteLine(morten.ToString() + "\n");

            Console.WriteLine(daniel.ToString() + "\n");

            Console.WriteLine(emil2.ToString() + "\n");



            Console.WriteLine("Commision:");
            CommissionEmployee jens  = new CommissionEmployee("Jens", "Clausen", 200, 0.05);
            CommissionEmployee mads2 = new CommissionEmployee("Mads", "Andersen", 400, 0.10);
            CommissionEmployee emil3 = new CommissionEmployee("Emil", "Cordsen", 999, 120);

            Console.WriteLine(jens.ToString() + "\n");

            Console.WriteLine(mads2.ToString() + "\n");

            Console.WriteLine(emil3.ToString() + "\n");

            Console.WriteLine("CommisionAndBasic:");
            BasicAndCommissionEmployee jens2 = new BasicAndCommissionEmployee("Jens", "Clausen", 200, 0.05, 200);
            BasicAndCommissionEmployee mads3 = new BasicAndCommissionEmployee("Mads", "Andersen", 400, 0.10, 400);
            BasicAndCommissionEmployee emil4 = new BasicAndCommissionEmployee("Emil", "Cordsen", 999, 120, 800);

            Console.WriteLine(jens2.ToString() + "\n");

            Console.WriteLine(mads3.ToString() + "\n");

            Console.WriteLine(emil4.ToString() + "\n");

            Console.ReadKey();
        }
Пример #3
0
        static void Main(string[] args)
        {
            SalariedEmployee           salariedEmployee           = new SalariedEmployee("Peter", "Parker", "SPIDER001", 10.0M);
            HourlyEmployee             hourlyEmployee             = new HourlyEmployee("Bruce", "Wayne", "BAT001", 15.0M, 45);
            CommissionEmployee         commissionEmployee         = new CommissionEmployee("David", "Banner", "HULK001");
            BasePlusCommissionEmployee basePlusCommissionEmployee = new BasePlusCommissionEmployee("Clark", "Kent", "SUPER001");



            Console.WriteLine(hourlyEmployee.ToString());
            Console.WriteLine(salariedEmployee.ToString());
            Console.WriteLine(commissionEmployee.ToString());
            Console.WriteLine(basePlusCommissionEmployee.ToString());
        }
Пример #4
0
    static void Main()
    {
        Console.WriteLine("(01) Empleado por Comision\n");

        var employee = new CommissionEmployee("Sue", "Jones",
                                              "222-22-2222", 1000.00M, .06M);

        Console.WriteLine("Informacion del empleado obtenida por las propiedades y metodos: \n");
        Console.WriteLine("Nombre                  : {0}", employee.FirstName);
        Console.WriteLine("Apellido                : {0}", employee.LastName);
        Console.WriteLine("Numero de Seguro Social : {0}", employee.SocialSecurityNumber);
        Console.WriteLine("Ventas Brutas           : {0}", employee.GrossSales);
        Console.WriteLine("Porcentaje de Comision  : {0}", employee.CommissionRate);
        Console.WriteLine("Ganancias               : {0}", employee.Earnings());

        employee.GrossSales     = 5000.00M; // Se actualiza las ventas brutas del empleado
        employee.CommissionRate = .1M;      // Se actualiza el porcentaje de comision del empleado

        Console.WriteLine("\n" + "Informacion actualizada obtenida por :" + "\n" + employee.ToString() + "\n");
        Console.WriteLine(employee);
        Console.WriteLine("Ganancias               : {0}\n", employee.Earnings());
    }
Пример #5
0
    static void Main()
    {
        // assign base-class reference to base-class variable
        var commissionEmployee = new CommissionEmployee(
            "Sue", "Jones", "222-22-2222", 10000.00M, .06M);

        // assign derived-class reference to derived-class variable
        var basePlusCommissionEmployee = new BasePlusCommissionEmployee(
            "Bob", "Lewis", "333-33-3333", 5000.00M, .04M, 300.00M);

        // invoke ToString and Earnings on base-class object
        // using base-class variable
        Console.WriteLine(
            "Call CommissionEmployee's ToString and Earnings methods " +
            "with base-class reference to base class object\n");
        Console.WriteLine(commissionEmployee.ToString());
        Console.WriteLine($"earnings: {commissionEmployee.Earnings()}\n");

        // invoke ToString and Earnings on derived-class object
        // using derived-class variable
        Console.WriteLine("Call BasePlusCommissionEmployee's ToString and" +
                          " Earnings methods with derived class reference to" +
                          " derived-class object\n");
        Console.WriteLine(basePlusCommissionEmployee.ToString());
        Console.WriteLine(
            $"earnings: {basePlusCommissionEmployee.Earnings()}\n");

        // invoke ToString and Earnings on derived-class object
        // using base-class variable
        CommissionEmployee commissionEmployee2 = basePlusCommissionEmployee;

        Console.WriteLine(
            "Call BasePlusCommissionEmployee's ToString and Earnings " +
            "methods with base class reference to derived-class object\n");
        Console.WriteLine(commissionEmployee2.ToString());
        Console.WriteLine(
            $"earnings: {basePlusCommissionEmployee.Earnings()}\n");
    }
Пример #6
0
    public static void Main(string[] args)
    {
        // assign base class reference to base class variable
        CommissionEmployee commissionEmployee = new CommissionEmployee(
            "Sue", "Jones", "222-22-2222", 10000.00M, .06M);

        // assign derived class reference to derived class variable
        BasePlusCommissionEmployee basePlusCommissionEmployee =
            new BasePlusCommissionEmployee("Bob", "Lewis",
                                           "333-33-3333", 5000.00M, .04M, 300.00M);

        // invoke ToString and Earnings on base class object
        // using base class variable
        Console.WriteLine("{0} {1}:\n\n{2}\n{3}: {4:C}\n",
                          "Call CommissionEmployee's ToString and Earnings methods",
                          "with base class reference to base class object",
                          commissionEmployee.ToString(),
                          "Earnings", commissionEmployee.Earnings());

        // invoke ToString and Earnings on derived class object
        // using derived class variable
        Console.WriteLine("{0} {1}:\n\n{2}\n{3}: {4:C}\n",
                          "Call BasePlusCommissionEmployee's ToString and Earnings",
                          "methods with derived class reference to derived class object",
                          basePlusCommissionEmployee.ToString(),
                          "Earnings", basePlusCommissionEmployee.Earnings());

        // invoke ToString and Earnings on derived class object
        // using base class variable
        CommissionEmployee commissionEmployee2 =
            basePlusCommissionEmployee;

        Console.WriteLine("{0} {1}:\n\n{2}\n{3}: {4:C}",
                          "Call BasePlusCommissionEmployee's ToString and Earnings",
                          "methods with base class reference to derived class object",
                          commissionEmployee2.ToString(), "Earnings",
                          commissionEmployee2.Earnings());
    } // end Main
Пример #7
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Payroll......");

            //Employee ee = new Employee("Bruce", "Wayne", "BAT001");
            //Console.WriteLine(ee.ToString());

            HourlyEmployee he = new HourlyEmployee("Diane", "Carter", "WW001");

            Console.WriteLine(he.ToString());

            SalariedEmployee se = new SalariedEmployee("Barry", "Allen", "FLASH001");

            Console.WriteLine(se.ToString());

            CommissionEmployee ce = new CommissionEmployee("Peter", "Parker", "SPIDER001");

            Console.WriteLine(ce.ToString());

            BasePlusCommissionEmployee bce = new BasePlusCommissionEmployee("Clark", "Kent", "SUPER001");

            Console.WriteLine(bce.ToString());
        }