static void Main(string[] args)
        {
            Position rectorPosition   = new Position("Rector", 1000);
            Position vicFinPosition   = new Position("Vicerector Financiero", 750);
            Position contadorPosition = new Position("Contador", 500);
            Position jefeFinPosition  = new Position("Jefe Financiero", 610);
            Position secFin1Position  = new Position("Secretario Financiero 1", 350);
            Position secFin2Position  = new Position("Secretario Financiero 2", 310);
            Position vicAcadPosition  = new Position("Vicerector Academico", 780);

            Position jefeRegPosition   = new Position("Jefe de Registros", 640);
            Position secReg2Position   = new Position("Secretario 2 del Jefe de Registros", 360);
            Position secReg1Position   = new Position("Secretario 1 del Jefe de Registros", 400);
            Position asist2Position    = new Position("Asistente 2", 170);
            Position asist1Position    = new Position("Asistente 1", 250);
            Position mensajeroPosition = new Position("Mensajero", 90);

            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);
            universityTree.CreatePosition(universityTree.Root, vicFinPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeFinPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin2Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, vicAcadPosition, rectorPosition.Name);

            universityTree.CreatePosition(universityTree.Root, jefeRegPosition, vicAcadPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secReg2Position, jefeRegPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secReg1Position, jefeRegPosition.Name);
            universityTree.CreatePosition(universityTree.Root, asist2Position, secReg1Position.Name);
            universityTree.CreatePosition(universityTree.Root, asist1Position, secReg1Position.Name);
            universityTree.CreatePosition(universityTree.Root, mensajeroPosition, asist2Position.Name);

            universityTree.PrintTree(universityTree.Root);
            Console.WriteLine("Total Salaries: $" + universityTree.AddSalaries(universityTree.Root));
        }
        static void Main(string[] args)
        {
            Position rectorPosition = new Position();

            rectorPosition.Name   = "rector";
            rectorPosition.Salary = 1000;

            Position vicFinPosition = new Position();

            vicFinPosition.Name   = "vicerector financiero";
            vicFinPosition.Salary = 750;
            Position contadorPosition = new Position();

            contadorPosition.Name   = "contador";
            contadorPosition.Salary = 500;
            Position jefeFinPosition = new Position();

            jefeFinPosition.Name   = "jefe financiero";
            jefeFinPosition.Salary = 610;
            Position secFin1Position = new Position();

            secFin1Position.Name   = "secretaria financiera 1";
            secFin1Position.Salary = 350;
            Position secFin2Position = new Position();

            secFin2Position.Name   = "secretaria financiera 2";
            secFin2Position.Salary = 310;

            Position vicAcadPosition = new Position();

            vicAcadPosition.Name   = "vicerector academico";
            vicAcadPosition.Salary = 780;
            Position jefeRegPosition = new Position();

            jefeRegPosition.Name   = "Jefe Regional";
            jefeRegPosition.Salary = 640;
            Position secReg1Position = new Position();

            secReg1Position.Name   = "secretaria Regional 1";
            secReg1Position.Salary = 400;
            Position asist1Position = new Position();

            asist1Position.Name   = "asistente 1";
            asist1Position.Salary = 250;
            Position asist2Position = new Position();

            asist2Position.Name   = "asistente 2";
            asist2Position.Salary = 170;
            Position mensajeroPosition = new Position();

            mensajeroPosition.Name   = "mensajero";
            mensajeroPosition.Salary = 90;
            Position secReg2Position = new Position();

            secReg2Position.Name   = "secretaria Regional 2";
            secReg2Position.Salary = 360;


            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);
            universityTree.CreatePosition(universityTree.Root, vicFinPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeFinPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin2Position, contadorPosition.Name);

            universityTree.CreatePosition(universityTree.Root, vicAcadPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeRegPosition, vicAcadPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secReg1Position, jefeRegPosition.Name);
            universityTree.CreatePosition(universityTree.Root, asist1Position, secReg1Position.Name);
            universityTree.CreatePosition(universityTree.Root, asist2Position, secReg1Position.Name);
            universityTree.CreatePosition(universityTree.Root, mensajeroPosition, asist2Position.Name);
            universityTree.CreatePosition(universityTree.Root, secReg2Position, jefeRegPosition.Name);

            universityTree.PrintTree(universityTree.Root);

            float totalSalary = universityTree.AddSalaries(universityTree.Root);

            Console.WriteLine($"Total salaries: {totalSalary}");

            Console.ReadLine();
        }
Пример #3
0
        static void Main(string[] args)
        {
            Position rectorPosition = new Position();

            rectorPosition.Name   = "rector";
            rectorPosition.Salary = 1000;
            rectorPosition.tax    = 0.28;

            Position vicFinPosition = new Position();

            vicFinPosition.Name   = "Vicerector financiero";
            vicFinPosition.Salary = 750;
            vicFinPosition.tax    = 0.24;

            Position contadorPosition = new Position();

            contadorPosition.Name   = "Contador";
            contadorPosition.Salary = 500;
            contadorPosition.tax    = 0.15;

            Position JefeFinPosition = new Position();

            JefeFinPosition.Name   = "Jefe financiero";
            JefeFinPosition.Salary = 610;
            JefeFinPosition.tax    = 0.21;

            Position secFin1Position = new Position();

            secFin1Position.Name   = "Secretaria financiera 1";
            secFin1Position.Salary = 350;
            secFin1Position.tax    = 0.1;

            Position secFin2Position = new Position();

            secFin2Position.Name   = "Secretaria financiera 2";
            secFin2Position.Salary = 310;
            secFin2Position.tax    = 0.08;

            Position vicAcadPosition = new Position();

            vicAcadPosition.Name   = "Vicerector académico";
            vicAcadPosition.Salary = 780;
            vicAcadPosition.tax    = 0.18;

            Position jefereg = new Position();

            jefereg.Name   = "Jefe reg ";
            jefereg.Salary = 640;
            jefereg.tax    = 0.21;

            Position sectreg2 = new Position();

            sectreg2.Name   = "Secretaria reg 2";
            sectreg2.Salary = 360;
            sectreg2.tax    = 0.04;

            Position sectreg1 = new Position();

            sectreg1.Name   = "Secretaria reg 1";
            sectreg1.Salary = 400;
            sectreg1.tax    = 0.06;

            Position asist2 = new Position();

            asist2.Name   = "Asistente 2";
            asist2.Salary = 170;
            asist2.tax    = 0.02;

            Position mensajero = new Position();

            mensajero.Name   = "Mensajero";
            mensajero.Salary = 90;
            mensajero.tax    = 0.01;

            Position asist1 = new Position();

            asist1.Name   = "Asistente 1";
            asist1.Salary = 250;
            asist1.tax    = 0.03;


            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);
            universityTree.CreatePosition(universityTree.Root, vicFinPosition, rectorPosition.Name);

            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin2Position, contadorPosition.Name);

            universityTree.CreatePosition(universityTree.Root, JefeFinPosition, vicFinPosition.Name);

            universityTree.CreatePosition(universityTree.Root, vicAcadPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefereg, vicAcadPosition.Name);
            universityTree.CreatePosition(universityTree.Root, sectreg2, jefereg.Name);

            universityTree.CreatePosition(universityTree.Root, sectreg1, jefereg.Name);
            universityTree.CreatePosition(universityTree.Root, asist2, sectreg1.Name);
            universityTree.CreatePosition(universityTree.Root, mensajero, asist2.Name);

            universityTree.CreatePosition(universityTree.Root, asist1, sectreg1.Name);


            universityTree.PrintTree(universityTree.Root);

            float totalSalary = universityTree.AddSalaries(universityTree.Root);

            Console.WriteLine($"Total salaries: {totalSalary}");

            universityTree.LongestSalary(universityTree.Root);
            Console.WriteLine($"The best salary is: {universityTree.countLongestSalary}");

            float SalaryAverage = universityTree.SalaryAverage();

            Console.WriteLine($" the salary average is: {SalaryAverage}");



            Console.WriteLine("whose salary do you want to know?");
            String find = Console.ReadLine();
            float  salaryForPosition = universityTree.SalaryForPosition(universityTree.Root, find);

            if (salaryForPosition == 0)
            {
                Console.WriteLine("the name is not valid");
            }
            else
            {
                Console.WriteLine($"this person's salary is: {salaryForPosition}");
            }

            double totalTaxes = universityTree.TotalTaxes(universityTree.Root);

            Console.WriteLine($"Total Taxes: {totalTaxes}");
        }
        static void Main(string[] args)
        {
            //RECTOR
            Position rectorPosition = new Position();

            rectorPosition.Name   = "Rector";
            rectorPosition.Salary = 1000;
            rectorPosition.Tax    = 0.25;

            //VICERECTOR FINANCIER0
            Position vicefinanPosition = new Position();

            vicefinanPosition.Name   = "Vicerector Financiero";
            vicefinanPosition.Salary = 750;
            vicefinanPosition.Tax    = 0.20;

            //CONTADOR
            Position contadorPosition = new Position();

            contadorPosition.Name   = "Contador";
            contadorPosition.Salary = 500;
            contadorPosition.Tax    = 0.30;

            //JEFE FINANCIERO
            Position jefeFinanPosition = new Position();

            jefeFinanPosition.Name   = "Jefe Financiero";
            jefeFinanPosition.Salary = 610;
            jefeFinanPosition.Tax    = 0.15;

            //SECRETARIA FINANCIERA 1
            Position secreFin1Position = new Position();

            secreFin1Position.Name   = "Secretaria Financiera 1";
            secreFin1Position.Salary = 350;
            secreFin1Position.Tax    = 0.02;

            //SECRETARIA FINANCIERA 2
            Position secreFin2Position = new Position();

            secreFin2Position.Name   = "Secretaria Financiera 2";
            secreFin2Position.Salary = 310;
            secreFin2Position.Tax    = 0.02;

            //VICERECTOR ACADEMICO
            Position viceacadPosition = new Position();

            viceacadPosition.Name   = "Vicerector Académico";
            viceacadPosition.Salary = 780;
            viceacadPosition.Tax    = 0.25;

            //JEFE DE REGISTRO
            Position jefeRegisPosition = new Position();

            jefeRegisPosition.Name   = "Jefe Registro";
            jefeRegisPosition.Salary = 640;
            jefeRegisPosition.Tax    = 0.12;

            //SECRETARIA DE REGISTRO 2
            Position secRegis2Position = new Position();

            secRegis2Position.Name   = "Secretaria de Registro 2";
            secRegis2Position.Salary = 360;
            secRegis2Position.Tax    = 0.02;

            //SECRETARIA DE REGISTRO 1
            Position secRegis1Position = new Position();

            secRegis1Position.Name   = "Secretaria de Registro 1";
            secRegis1Position.Salary = 400;
            secRegis1Position.Tax    = 0.02;

            //ASISTENTE 2
            Position asis2Position = new Position();

            asis2Position.Name   = "Asistente 2";
            asis2Position.Salary = 170;
            asis2Position.Tax    = 0.00;

            //ASISTENTE 1
            Position asis1Position = new Position();

            asis1Position.Name   = "Asistente 1";
            asis1Position.Salary = 250;
            asis1Position.Tax    = 0.00;

            //MENSAJERO
            Position mensajeroPosition = new Position();

            mensajeroPosition.Name   = "Mensajero";
            mensajeroPosition.Salary = 90;
            mensajeroPosition.Tax    = 0.00;


            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);
            universityTree.CreatePosition(universityTree.Root, vicefinanPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicefinanPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secreFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secreFin2Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeFinanPosition, vicefinanPosition.Name);

            universityTree.CreatePosition(universityTree.Root, viceacadPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeRegisPosition, viceacadPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secRegis2Position, jefeRegisPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secRegis1Position, jefeRegisPosition.Name);
            universityTree.CreatePosition(universityTree.Root, asis2Position, secRegis1Position.Name);
            universityTree.CreatePosition(universityTree.Root, mensajeroPosition, asis2Position.Name);
            universityTree.CreatePosition(universityTree.Root, asis1Position, secRegis1Position.Name);

            universityTree.PrintTree(universityTree.Root);

            //SUMATORIA DE TODOS LOS SALARIOS DEL ARBOL
            float totalSalary = universityTree.AddSalaries(universityTree.Root);

            Console.WriteLine($"Total Salaries: {totalSalary}");

            //Console.ReadLine();

            //Get the longest salary (without including "the principal". Point 1
            float longestSalary = universityTree.longestSalary(universityTree.Root);

            Console.WriteLine($"the longest salary is: {longestSalary}");

            //Average Salaries. Point 2
            float averageSalaries = universityTree.averageSalaries(universityTree.Root);

            Console.WriteLine($"Average Salaries: {averageSalaries}");

            //How much is the salary given a certain position, Point 3
            Console.Write("Insert Name: ");
            string nametemp       = Console.ReadLine();
            float  salaryEmployee = universityTree.salaryEmployee(universityTree.Root, nametemp);

            Console.WriteLine($"the salary of {nametemp} is: {salaryEmployee}");

            //Add salary tax (percentaje 0%-30%), each position has a different tax percentaje, Point 4
            float taxSalary = universityTree.taxSalary(universityTree.Root);

            Console.WriteLine($"the sumatory tax is {taxSalary}");
        }
        static void Main(string[] args)
        {
            Position rectorPosition = new Position();

            rectorPosition.Name   = "rector";
            rectorPosition.Salary = 1000;
            rectorPosition.Tax    = 0.1;

            Position vicFinPosition = new Position();

            vicFinPosition.Name   = "Vicerector financiero";
            vicFinPosition.Salary = 750;
            vicFinPosition.Tax    = 0.5;

            Position contadorPosition = new Position();

            contadorPosition.Name   = "Contador";
            contadorPosition.Salary = 500;
            contadorPosition.Tax    = 0.5;

            Position secFin1Position = new Position();

            secFin1Position.Name   = "Secretaria Financiera 1";
            secFin1Position.Salary = 350;
            secFin1Position.Tax    = 0.5;

            Position secFin2Position = new Position();

            secFin2Position.Name   = "Secretaria Financiera 2";
            secFin2Position.Salary = 310;
            secFin2Position.Tax    = 0.5;

            Position jefFinPosition = new Position();

            jefFinPosition.Name   = "Jefe Financiera";
            jefFinPosition.Salary = 610;
            jefFinPosition.Tax    = 0.5;

            Position vicAcadePosition = new Position();

            vicAcadePosition.Name   = "Vicerector Academico";
            vicAcadePosition.Salary = 780;
            vicAcadePosition.Tax    = 0.5;

            Position jefRegPosition = new Position();

            jefRegPosition.Name   = "Jefe Registro";
            jefRegPosition.Salary = 640;
            jefRegPosition.Tax    = 0.5;


            Position secReg2Position = new Position();

            secReg2Position.Name   = "Secretaria Registro 2";
            secReg2Position.Salary = 360;
            secReg2Position.Tax    = 0.5;

            Position secReg1Position = new Position();

            secReg1Position.Name   = "Secretaria Registro 1";
            secReg1Position.Salary = 400;
            secReg1Position.Tax    = 0.5;

            Position asist2Position = new Position();

            asist2Position.Name   = "Asistente 2";
            asist2Position.Salary = 170;
            asist2Position.Tax    = 0.5;

            Position mensajeroPosition = new Position();

            mensajeroPosition.Name   = "Mensajero";
            mensajeroPosition.Salary = 90;
            mensajeroPosition.Tax    = 0.5;

            Position asist1Position = new Position();

            asist1Position.Name   = "Asistente 1";
            asist1Position.Salary = 250;
            asist1Position.Tax    = 0.5;


            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);
            universityTree.CreatePosition(universityTree.Root, vicFinPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin2Position, contadorPosition.Name);

            universityTree.CreatePosition(universityTree.Root, jefFinPosition, vicFinPosition.Name);

            universityTree.CreatePosition(universityTree.Root, vicAcadePosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefRegPosition, vicAcadePosition.Name);
            universityTree.CreatePosition(universityTree.Root, secReg2Position, jefRegPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secReg1Position, jefRegPosition.Name);
            universityTree.CreatePosition(universityTree.Root, asist2Position, secReg1Position.Name);
            universityTree.CreatePosition(universityTree.Root, mensajeroPosition, asist2Position.Name);

            universityTree.CreatePosition(universityTree.Root, asist1Position, secReg1Position.Name);

            universityTree.PrintTree(universityTree.Root);

            float totalSalary = universityTree.AddSalaries(universityTree.Root);

            Console.WriteLine($"Total salaries: {totalSalary}" + System.Environment.NewLine);

            float higherSalary = universityTree.higherSalarym(universityTree.Root);

            Console.WriteLine($"Higher Salary: {higherSalary}" + System.Environment.NewLine);

            int nodes = universityTree.numberNodes(universityTree.Root);

            Console.WriteLine($"Number of Nodes: {nodes}" + System.Environment.NewLine);

            float averageSalary = totalSalary / nodes;

            Console.WriteLine($"Average Salary: {averageSalary}" + System.Environment.NewLine);

            float specificSalary = universityTree.specificSalarym(universityTree.Root, "Jefe Financiera");

            Console.WriteLine($"Specific Salary: {specificSalary}" + System.Environment.NewLine);

            double totalTaxes = universityTree.totalTaxes(universityTree.Root);

            Console.WriteLine($"Total Taxes: {totalTaxes}" + System.Environment.NewLine);

            Console.ReadLine();
        }
Пример #6
0
        static void Main(string[] args)
        {
            Position rectorPosition = new Position();

            rectorPosition.Name   = "rector";
            rectorPosition.Salary = 1000;
            rectorPosition.tax    = 0.25;

            Position vicFinPosition = new Position();

            vicFinPosition.Name   = "vicerector financiero";
            vicFinPosition.Salary = 750;
            vicFinPosition.tax    = 0.2;

            Position contadorPosition = new Position();

            contadorPosition.Name   = "contador";
            contadorPosition.Salary = 500;
            contadorPosition.tax    = 0.13;

            Position jefeFinPosition = new Position();

            jefeFinPosition.Name   = "jefe financiero";
            jefeFinPosition.Salary = 610;
            jefeFinPosition.tax    = 0.16;

            Position secFin1Position = new Position();

            secFin1Position.Name   = "secretaria financiera 1";
            secFin1Position.Salary = 350;
            secFin1Position.tax    = 0.11;

            Position secFin2Position = new Position();

            secFin2Position.Name   = "secretaria financiera 2";
            secFin2Position.Salary = 310;
            secFin2Position.tax    = 0.09;

            Position vicAcadPosition = new Position();

            vicAcadPosition.Name   = "vicerector academico";
            vicAcadPosition.Salary = 780;
            vicAcadPosition.tax    = 0.21;

            Position jefeRegPosition = new Position();

            jefeRegPosition.Name   = "Jefe Regional";
            jefeRegPosition.Salary = 640;
            jefeRegPosition.tax    = 0.17;

            Position secReg1Position = new Position();

            secReg1Position.Name   = "secretaria Regional 1";
            secReg1Position.Salary = 400;
            secReg1Position.tax    = 0.12;

            Position asist1Position = new Position();

            asist1Position.Name   = "asistente 1";
            asist1Position.Salary = 250;
            asist1Position.tax    = 0.07;

            Position asist2Position = new Position();

            asist2Position.Name   = "asistente 2";
            asist2Position.Salary = 170;
            asist2Position.tax    = 0.05;

            Position mensajeroPosition = new Position();

            mensajeroPosition.Name   = "mensajero";
            mensajeroPosition.Salary = 90;
            mensajeroPosition.tax    = 0.03;

            Position secReg2Position = new Position();

            secReg2Position.Name   = "secretaria Regional 2";
            secReg2Position.Salary = 360;
            secReg2Position.tax    = 0.1;


            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);
            universityTree.CreatePosition(universityTree.Root, vicFinPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeFinPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin2Position, contadorPosition.Name);

            universityTree.CreatePosition(universityTree.Root, vicAcadPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeRegPosition, vicAcadPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secReg1Position, jefeRegPosition.Name);
            universityTree.CreatePosition(universityTree.Root, asist1Position, secReg1Position.Name);
            universityTree.CreatePosition(universityTree.Root, asist2Position, secReg1Position.Name);
            universityTree.CreatePosition(universityTree.Root, mensajeroPosition, asist2Position.Name);
            universityTree.CreatePosition(universityTree.Root, secReg2Position, jefeRegPosition.Name);

            universityTree.PrintTree(universityTree.Root);

            float totalSalary = universityTree.AddSalaries(universityTree.Root);

            Console.WriteLine($"Total salaries: {totalSalary}");

            universityTree.LongestSalary(universityTree.Root);
            float LongestSalary = universityTree.getLongestSal();

            Console.WriteLine($"Longest Salary: {LongestSalary}");

            float SalaryAverage = universityTree.SalaryAverage();

            Console.WriteLine($"Salary Average: {SalaryAverage}");


            Console.WriteLine("write position here:");
            string pos            = Console.ReadLine();
            float  SalaryPosition = universityTree.SalaryPosition(universityTree.Root, pos);

            if (SalaryPosition == 0)
            {
                Console.WriteLine("wrong name");
            }
            else
            {
                Console.WriteLine($"Salary position: {SalaryPosition}");
            }

            double TotalTaxes = universityTree.TotalTaxes(universityTree.Root);

            Console.WriteLine($"Total Taxes: {TotalTaxes}");

            Console.ReadLine();
        }
Пример #7
0
        static void Main(string[] args)
        {
            Position rectorPosition = new Position();

            rectorPosition.Name   = "rector";
            rectorPosition.Salary = 1000;
            rectorPosition.Tax    = 0.15;

            Position vicFinanPosition = new Position();

            vicFinanPosition.Name   = "vecerector financiero";
            vicFinanPosition.Salary = 750;
            vicFinanPosition.Tax    = 0.10;

            Position contadorPosition = new Position();

            contadorPosition.Name   = "contador";
            contadorPosition.Salary = 500;
            contadorPosition.Tax    = 0.05;


            Position jefeFinPosition = new Position();

            jefeFinPosition.Name   = "jefe financiero";
            jefeFinPosition.Salary = 610;
            jefeFinPosition.Tax    = 0.12;

            Position secreFin1Position = new Position();

            secreFin1Position.Name   = "secretaria financiera 1 ";
            secreFin1Position.Salary = 350;
            secreFin1Position.Tax    = 0.08;

            Position secreFin2Position = new Position();

            secreFin2Position.Name   = "secretaria financiera 1 ";
            secreFin2Position.Salary = 310;
            secreFin2Position.Tax    = 0.03;

            Position vicAcademicPosition = new Position();

            vicAcademicPosition.Name   = "vicerector academico";
            vicAcademicPosition.Salary = 780;
            vicAcademicPosition.Tax    = 0.18;

            Position jefeRegisPosition = new Position();

            jefeRegisPosition.Name   = "jefe registro";
            jefeRegisPosition.Salary = 640;
            jefeRegisPosition.Tax    = 0.20;

            Position secreRegis2Position = new Position();

            secreRegis2Position.Name   = "secretaria de registro 2";
            secreRegis2Position.Salary = 360;
            secreRegis2Position.Tax    = 0.10;

            Position secreRegis1Position = new Position();

            secreRegis1Position.Name   = "secretaria de resgistro 1 ";
            secreRegis1Position.Salary = 400;

            Position asisten2Position = new Position();

            asisten2Position.Name   = "asistente 2";
            asisten2Position.Salary = 170;
            asisten2Position.Tax    = 0.09;

            Position asisten1Position = new Position();

            asisten1Position.Name   = "asistente 1";
            asisten1Position.Salary = 250;
            asisten1Position.Tax    = 0.15;

            Position mensajeroPosition = new Position();

            mensajeroPosition.Name   = "mensajero";
            mensajeroPosition.Salary = 90;
            mensajeroPosition.Tax    = 0.05;

            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);
            universityTree.CreatePosition(universityTree.Root, vicFinanPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicFinanPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secreFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secreFin2Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeFinPosition, vicFinanPosition.Name);
            universityTree.CreatePosition(universityTree.Root, vicAcademicPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeRegisPosition, vicAcademicPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secreRegis2Position, jefeRegisPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secreRegis1Position, jefeRegisPosition.Name);
            universityTree.CreatePosition(universityTree.Root, asisten2Position, secreRegis1Position.Name);
            universityTree.CreatePosition(universityTree.Root, mensajeroPosition, asisten2Position.Name);
            universityTree.CreatePosition(universityTree.Root, asisten1Position, secreRegis1Position.Name);
            universityTree.CreatePosition(universityTree.Root, asisten1Position, secreRegis1Position.Name);



            universityTree.PrintTree(universityTree.Root);

            float totalSalary = universityTree.AddSalaries(universityTree.Root);

            Console.WriteLine($"Total salaries: {totalSalary}");

            //Console.ReadLine();

            //Punto 1 Obtenga el salario más largo (sin incluir "el principal".
            float longestSalary = universityTree.longestSalary(universityTree.Root);

            Console.WriteLine($"the longest salary is: {longestSalary}");

            //Punto 2 Salarios medios.
            float averageSalaries = universityTree.averageSalaries(universityTree.Root);

            Console.WriteLine($"Average Salaries: {averageSalaries}");

            //Punto 3 ¿Cuánto es el salario dado a un puesto determinado,

            Console.Write("Insert Name: ");
            string nametemp       = Console.ReadLine();
            float  salaryEmployee = universityTree.salaryEmployee(universityTree.Root, nametemp);

            Console.WriteLine($"the salary of {nametemp} is: {salaryEmployee}");

            //Punto 4 Agregue el impuesto al salario (porcentaje 0% -30%), cada puesto tiene un porcentaje de impuesto diferente,
            float taxSalary = universityTree.taxSalary(universityTree.Root);

            Console.WriteLine($"the sumatory tax is {taxSalary}");
        }
        static void Main(string[] args)
        {
            //RECTOR
            Position rectorPosition = new Position();

            rectorPosition.Name   = "Rector";
            rectorPosition.Salary = 1000;

            //VICERECTOR FINANCIER0
            Position vicefinanPosition = new Position();

            vicefinanPosition.Name   = "Vicerector Financiero";
            vicefinanPosition.Salary = 750;

            //CONTADOR
            Position contadorPosition = new Position();

            contadorPosition.Name   = "Contador";
            contadorPosition.Salary = 500;

            //JEFE FINANCIERO
            Position jefeFinanPosition = new Position();

            jefeFinanPosition.Name   = "Jefe Financiero";
            jefeFinanPosition.Salary = 610;

            //SECRETARIA FINANCIERA 1
            Position secreFin1Position = new Position();

            secreFin1Position.Name   = "Secretaria Financiera 1";
            secreFin1Position.Salary = 350;

            //SECRETARIA FINANCIERA 2
            Position secreFin2Position = new Position();

            secreFin2Position.Name   = "Secretaria Financiera 2";
            secreFin2Position.Salary = 310;

            //VICERECTOR ACADEMICO
            Position viceacadPosition = new Position();

            viceacadPosition.Name   = "Vicerector Académico";
            viceacadPosition.Salary = 780;

            //JEFE DE REGISTRO
            Position jefeRegisPosition = new Position();

            jefeRegisPosition.Name   = "Jefe Registro";
            jefeRegisPosition.Salary = 640;

            //SECRETARIA DE REGISTRO 2
            Position secRegis2Position = new Position();

            secRegis2Position.Name   = "Secretaria de Registro 2";
            secRegis2Position.Salary = 360;

            //SECRETARIA DE REGISTRO 1
            Position secRegis1Position = new Position();

            secRegis1Position.Name   = "Secretaria de Registro 1";
            secRegis1Position.Salary = 400;

            //ASISTENTE 2
            Position asis2Position = new Position();

            asis2Position.Name   = "Asistente 2";
            asis2Position.Salary = 170;

            //ASISTENTE 1
            Position asis1Position = new Position();

            asis1Position.Name   = "Asistente 1";
            asis1Position.Salary = 250;

            //MENSAJERO
            Position mensajeroPosition = new Position();

            mensajeroPosition.Name   = "Mensajero";
            mensajeroPosition.Salary = 90;


            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);
            universityTree.CreatePosition(universityTree.Root, vicefinanPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicefinanPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secreFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secreFin2Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeFinanPosition, vicefinanPosition.Name);

            universityTree.CreatePosition(universityTree.Root, viceacadPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeRegisPosition, viceacadPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secRegis2Position, jefeRegisPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secRegis1Position, jefeRegisPosition.Name);
            universityTree.CreatePosition(universityTree.Root, asis2Position, secRegis1Position.Name);
            universityTree.CreatePosition(universityTree.Root, mensajeroPosition, asis2Position.Name);
            universityTree.CreatePosition(universityTree.Root, asis1Position, secRegis1Position.Name);

            universityTree.PrintTree(universityTree.Root);

            float totalSalary = universityTree.AddSalaries(universityTree.Root);

            Console.WriteLine($"Total Salaries: {totalSalary}");

            Console.ReadLine();
        }
Пример #9
0
        static void Main(string[] args)
        {
            //The objects that are needed are created
            Position rectorPosition = new Position();

            rectorPosition.Name   = "Rector";
            rectorPosition.Salary = 1000;

            Position vicFinPosition = new Position();

            vicFinPosition.Name   = "Vicerector Financiero";
            vicFinPosition.Salary = 750;

            Position contadorPosition = new Position();

            contadorPosition.Name   = "Contador";
            contadorPosition.Salary = 500;

            Position jefeFinPosition = new Position();

            jefeFinPosition.Name   = "Jefe Financiero";
            jefeFinPosition.Salary = 610;

            Position secFin1Position = new Position();

            secFin1Position.Name   = "Secretaria Financiera 1";
            secFin1Position.Salary = 350;

            Position secFin2Position = new Position();

            secFin2Position.Name   = "Secretaria Financiera 2";
            secFin2Position.Salary = 310;

            Position vicAcademicoPosition = new Position();

            vicAcademicoPosition.Name   = "Vicerector Academico";
            vicAcademicoPosition.Salary = 780;

            Position jefeRegPosition = new Position();

            jefeRegPosition.Name   = "Jefe de registro Academico";
            jefeRegPosition.Salary = 640;

            Position secGen2Position = new Position();

            secGen2Position.Name   = "Secretaria General 2";
            secGen2Position.Salary = 360;

            Position secGen1Position = new Position();

            secGen1Position.Name   = "Secretaria General 1";
            secGen1Position.Salary = 400;

            Position asistente2Position = new Position();

            asistente2Position.Name   = "Asistente 2";
            asistente2Position.Salary = 170;

            Position mensajeroPosition = new Position();

            mensajeroPosition.Name   = "Mensajero";
            mensajeroPosition.Salary = 90;

            Position asistente1Position = new Position();

            asistente1Position.Name   = "Asistente 1";
            asistente1Position.Salary = 250;

            //Create the university tree, creating positions
            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);

            universityTree.CreatePosition(universityTree.Root, vicFinPosition, rectorPosition.Name);

            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin2Position, contadorPosition.Name);

            universityTree.CreatePosition(universityTree.Root, jefeFinPosition, vicFinPosition.Name);

            universityTree.CreatePosition(universityTree.Root, vicAcademicoPosition, rectorPosition.Name);

            universityTree.CreatePosition(universityTree.Root, jefeRegPosition, vicAcademicoPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secGen2Position, jefeRegPosition.Name);

            universityTree.CreatePosition(universityTree.Root, secGen1Position, jefeRegPosition.Name);
            universityTree.CreatePosition(universityTree.Root, asistente2Position, secGen1Position.Name);
            universityTree.CreatePosition(universityTree.Root, mensajeroPosition, asistente2Position.Name);

            universityTree.CreatePosition(universityTree.Root, asistente1Position, secGen1Position.Name);

            universityTree.PrintTree(universityTree.Root);

            float totalSalary = universityTree.AddSalaries(universityTree.Root);

            Console.WriteLine($"\nTotal Saly: {totalSalary}");

            Console.ReadLine();
        }
Пример #10
0
        static void Main(string[] args)
        {
            Position rectorPosition = new Position();

            rectorPosition.Name   = "rector";
            rectorPosition.Salary = 1000;

            Position vicFinPosition = new Position();

            vicFinPosition.Name   = "Vicerector financiero";
            vicFinPosition.Salary = 750;

            Position contadorPosition = new Position();

            contadorPosition.Name   = "Contador";
            contadorPosition.Salary = 500;

            Position JefeFinPosition = new Position();

            JefeFinPosition.Name   = "Jefe financiero";
            JefeFinPosition.Salary = 610;

            Position secFin1Position = new Position();

            secFin1Position.Name   = "Secretaria financiera 1";
            secFin1Position.Salary = 350;

            Position secFin2Position = new Position();

            secFin2Position.Name   = "Secretaria financiera 2";
            secFin2Position.Salary = 310;

            Position vicAcadPosition = new Position();

            vicAcadPosition.Name   = "Vicerector académico";
            vicAcadPosition.Salary = 780;

            Position jefereg = new Position();

            jefereg.Name   = "Jefe reg ";
            jefereg.Salary = 640;

            Position sectreg2 = new Position();

            sectreg2.Name   = "Secretaria reg 2";
            sectreg2.Salary = 360;

            Position sectreg1 = new Position();

            sectreg1.Name   = "Secretaria reg 1";
            sectreg1.Salary = 400;

            Position asist2 = new Position();

            asist2.Name   = "Asistente 2";
            asist2.Salary = 170;

            Position mensajero = new Position();

            mensajero.Name   = "Mensajero";
            mensajero.Salary = 90;

            Position asist1 = new Position();

            asist1.Name   = "Asistente 1";
            asist1.Salary = 250;

            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);
            universityTree.CreatePosition(universityTree.Root, vicFinPosition, rectorPosition.Name);

            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin2Position, contadorPosition.Name);

            universityTree.CreatePosition(universityTree.Root, JefeFinPosition, vicFinPosition.Name);

            universityTree.CreatePosition(universityTree.Root, vicAcadPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefereg, vicAcadPosition.Name);
            universityTree.CreatePosition(universityTree.Root, sectreg2, jefereg.Name);

            universityTree.CreatePosition(universityTree.Root, sectreg1, jefereg.Name);
            universityTree.CreatePosition(universityTree.Root, asist2, sectreg1.Name);
            universityTree.CreatePosition(universityTree.Root, mensajero, asist2.Name);

            universityTree.CreatePosition(universityTree.Root, asist1, sectreg1.Name);

            universityTree.PrintTree(universityTree.Root);
            float totalSalary = universityTree.AddSalaries(universityTree.Root);

            Console.WriteLine($"Total salaries: {totalSalary}");
            Console.ReadLine();
        }
        static void Main(string[] args)
        {
            Position rectorPosition = new Position();

            rectorPosition.Name       = "rector";
            rectorPosition.Salary     = 1000;
            rectorPosition.Porsentaje = 0.10f;
            rectorPosition.NNodo      = 1;
            rectorPosition.total      = 100;

            Position vicFinPosition = new Position();

            vicFinPosition.Name       = "Vicerector finaciero";
            vicFinPosition.Salary     = 750;
            vicFinPosition.Porsentaje = 0.05f;
            vicFinPosition.NNodo      = 1;
            vicFinPosition.total      = 37.5f;


            Position contadorPosition = new Position();

            contadorPosition.Name       = "contador";
            contadorPosition.Salary     = 500;
            contadorPosition.Porsentaje = 0.15f;
            contadorPosition.NNodo      = 1;
            contadorPosition.total      = 75;


            Position jefeFinPosition = new Position();

            jefeFinPosition.Name       = "jefe Financiero";
            jefeFinPosition.Salary     = 610;
            jefeFinPosition.Porsentaje = 0.20f;
            jefeFinPosition.NNodo      = 1;
            jefeFinPosition.total      = 122;


            Position secreFin1Position = new Position();

            secreFin1Position.Name       = "secretaria finaciera 1";
            secreFin1Position.Salary     = 350;
            secreFin1Position.Porsentaje = 0.07f;
            secreFin1Position.NNodo      = 1;
            secreFin1Position.total      = 24.5f;


            Position secreFin2Position = new Position();

            secreFin2Position.Name       = "secretaria finaciera 2";
            secreFin2Position.Salary     = 310;
            secreFin2Position.Porsentaje = 0.07f;
            secreFin2Position.NNodo      = 1;
            secreFin2Position.total      = 21.7f;



            Position vicAcadPosition = new Position();

            vicAcadPosition.Name       = "Vicerector Academico";
            vicAcadPosition.Salary     = 780;
            vicAcadPosition.Porsentaje = 0.25f;
            vicAcadPosition.NNodo      = 1;
            vicAcadPosition.total      = 195;

            Position jefeRegPosition = new Position();

            jefeRegPosition.Name       = "Jefe de Registro";
            jefeRegPosition.Salary     = 640;
            jefeRegPosition.Porsentaje = 0.16f;
            jefeRegPosition.NNodo      = 1;
            jefeRegPosition.total      = 102.3f;

            Position secreReg1Position = new Position();

            secreReg1Position.Name       = "Secretaria de Registro 1";
            secreReg1Position.Salary     = 400;
            secreReg1Position.Porsentaje = 0.08f;
            secreReg1Position.NNodo      = 1;
            secreReg1Position.total      = 32;

            Position asist1Position = new Position();

            asist1Position.Name       = "Asistente 1 ";
            asist1Position.Salary     = 250;
            asist1Position.Porsentaje = 0.09f;
            asist1Position.NNodo      = 1;
            asist1Position.total      = 22.5f;


            Position asist2Position = new Position();

            asist2Position.Name       = "Asistente 2 ";
            asist2Position.Salary     = 170;
            asist2Position.Porsentaje = 0.06f;
            asist2Position.NNodo      = 1;
            asist2Position.total      = 10.2f;

            Position mensajPosition = new Position();

            mensajPosition.Name       = "Mensajero ";
            mensajPosition.Salary     = 90;
            mensajPosition.Porsentaje = 0.02f;
            mensajPosition.NNodo      = 1;
            mensajPosition.total      = 1.8f;

            Position secreReg2Position = new Position();

            secreReg2Position.Name       = "Secretaria de Registro 2";
            secreReg2Position.Salary     = 360;
            secreReg2Position.Porsentaje = 0.03f;
            secreReg2Position.NNodo      = 1;
            secreReg2Position.total      = 10.8f;

            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);
            universityTree.CreatePosition(universityTree.Root, vicFinPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secreFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secreFin2Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeFinPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, vicAcadPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeRegPosition, vicAcadPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secreReg1Position, jefeRegPosition.Name);

            universityTree.CreatePosition(universityTree.Root, asist1Position, secreReg1Position.Name);
            universityTree.CreatePosition(universityTree.Root, asist2Position, secreReg1Position.Name);
            universityTree.CreatePosition(universityTree.Root, mensajPosition, asist2Position.Name);
            universityTree.CreatePosition(universityTree.Root, secreReg2Position, jefeRegPosition.Name);

            vicFinciero vicFinciero = new vicFinciero();

            vicFinciero.CreatePosition(null, vicFinPosition, null);
            universityTree.CreatePosition(vicFinciero.Root, contadorPosition, vicFinPosition.Name);
            universityTree.CreatePosition(vicFinciero.Root, jefeFinPosition, vicFinPosition.Name);

            universityTree.printTree(vicFinciero.Root);

            float totalSalary2 = universityTree.Addsalaries(vicFinciero.Root);

            Console.WriteLine($"total de salarios:{totalSalary2} ");

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

            universityTree.printTree(universityTree.Root);

            float totalSalary = universityTree.Addsalaries(universityTree.Root);

            Console.WriteLine($"total de salarios:{totalSalary} ");

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



            float calculoNodo = universityTree.CalcNnodo(universityTree.Root);

            Console.WriteLine($"cantidad de nodo :{ calculoNodo} ");
            Console.ReadLine();

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



            float PromedioSalario = totalSalary / calculoNodo;

            Console.WriteLine($"El promedio del salario es :{ PromedioSalario} ");

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



            float totalpromedio = universityTree.Addpromedios(universityTree.Root);

            Console.WriteLine($"El total de los impuestos recaudados es :{totalpromedio} ");
        }
        static void Main(string[] args)
        {
            Position rector = new Position();

            rector.Name       = "Rector";
            rector.Salary     = 1000;
            rector.Percentage = 29;
            rector.TaxValue   = Position.TaxValuCalculate(rector.Salary, rector.Percentage);

            Position viceFinanciero = new Position();

            viceFinanciero.Name       = "Vicerector Financiero";
            viceFinanciero.Salary     = 750;
            viceFinanciero.Percentage = 27;
            viceFinanciero.TaxValue   = Position.TaxValuCalculate(viceFinanciero.Salary, viceFinanciero.Percentage);

            Position contador = new Position();

            contador.Name       = "Contador";
            contador.Salary     = 500;
            contador.Percentage = 24;
            contador.TaxValue   = Position.TaxValuCalculate(contador.Salary, contador.Percentage);

            Position jefeFinPosition = new Position();

            jefeFinPosition.Name       = "Jefe Financiero";
            jefeFinPosition.Salary     = 610;
            jefeFinPosition.Percentage = 21;
            jefeFinPosition.TaxValue   = (jefeFinPosition.Salary * jefeFinPosition.Percentage) / 100;

            Position secFin1Position = new Position();

            secFin1Position.Name       = "Secretaria Financiera 1";
            secFin1Position.Salary     = 350;
            secFin1Position.Percentage = 16;
            secFin1Position.TaxValue   = (secFin1Position.Salary * secFin1Position.Percentage) / 100;

            Position secFin2Position = new Position();

            secFin2Position.Name       = "Secretaria Financiera 2";
            secFin2Position.Salary     = 310;
            secFin2Position.Percentage = 16;
            secFin2Position.TaxValue   = (secFin2Position.Salary * secFin2Position.Percentage) / 100;

            Position vicAcademicoPosition = new Position();

            vicAcademicoPosition.Name       = "Vicerector Academico";
            vicAcademicoPosition.Salary     = 780;
            vicAcademicoPosition.Percentage = 24;
            vicAcademicoPosition.TaxValue   = (vicAcademicoPosition.Salary * vicAcademicoPosition.Percentage) / 100;

            Position jefeRegPosition = new Position();

            jefeRegPosition.Name       = "Jefe de registro Academico";
            jefeRegPosition.Salary     = 640;
            jefeRegPosition.Percentage = 22;
            jefeRegPosition.TaxValue   = (jefeRegPosition.Salary * jefeRegPosition.Percentage) / 100;

            Position secGen2Position = new Position();

            secGen2Position.Name       = "Secretaria General 2";
            secGen2Position.Salary     = 360;
            secGen2Position.Percentage = 16;
            secGen2Position.TaxValue   = (secGen2Position.Salary * secGen2Position.Percentage) / 100;

            Position secGen1Position = new Position();

            secGen1Position.Name       = "Secretaria General 1";
            secGen1Position.Salary     = 400;
            secGen1Position.Percentage = 17;
            secGen1Position.TaxValue   = (secGen1Position.Salary * secGen1Position.Percentage) / 100;

            Position asistente2Position = new Position();

            asistente2Position.Name       = "Asistente 2";
            asistente2Position.Salary     = 170;
            asistente2Position.Percentage = 9;
            asistente2Position.TaxValue   = (asistente2Position.Salary * asistente2Position.Percentage) / 100;

            Position mensajeroPosition = new Position();

            mensajeroPosition.Name       = "Mensajero";
            mensajeroPosition.Salary     = 90;
            mensajeroPosition.Percentage = 1;
            mensajeroPosition.TaxValue   = (mensajeroPosition.Salary * mensajeroPosition.Percentage) / 100;

            Position asistente1Position = new Position();

            asistente1Position.Name       = "Asistente 1";
            asistente1Position.Salary     = 250;
            asistente1Position.Percentage = 8;
            asistente1Position.TaxValue   = (asistente1Position.Salary * asistente1Position.Percentage) / 100;


            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rector, null);
            universityTree.CreatePosition(universityTree.Root, viceFinanciero, rector.Name);

            universityTree.CreatePosition(universityTree.Root, contador, viceFinanciero.Name);
            universityTree.CreatePosition(universityTree.Root, secFin1Position, contador.Name);
            universityTree.CreatePosition(universityTree.Root, secFin2Position, contador.Name);

            universityTree.CreatePosition(universityTree.Root, jefeFinPosition, viceFinanciero.Name);

            universityTree.CreatePosition(universityTree.Root, vicAcademicoPosition, rector.Name);

            universityTree.CreatePosition(universityTree.Root, jefeRegPosition, vicAcademicoPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secGen2Position, jefeRegPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secGen1Position, jefeRegPosition.Name);
            universityTree.CreatePosition(universityTree.Root, asistente2Position, secGen1Position.Name);
            universityTree.CreatePosition(universityTree.Root, mensajeroPosition, asistente2Position.Name);
            universityTree.CreatePosition(universityTree.Root, asistente1Position, secGen1Position.Name);

            Console.WriteLine("{0,30} {1,10} {2,10} {3,10}", "POSITION", "SALARY", "% TAX", "TAX VALUE\n");

            universityTree.PrintTree(universityTree.Root);


            float sumSalary1 = universityTree.SumSalaries(universityTree.Root);

            Console.WriteLine("\n{0,30} {1,13}", "The sum of salaries is:", $"{sumSalary1} ");


            float higherLeft  = universityTree.SalaryHigher(universityTree.Root.Left);
            float higherRight = universityTree.SalaryHigher(universityTree.Root.Right);

            if (higherLeft >= higherRight)
            {
                Console.WriteLine($"\nP 1. The higher salary is: {higherLeft} ");
            }
            else
            {
                Console.WriteLine($"\nP 1. The higher salary is: {higherRight} ");
            }


            float count1 = universityTree.Count(universityTree.Root);

            double promedio = (sumSalary1 / count1);

            promedio = Math.Round(promedio, 1);

            Console.WriteLine($"\nP 2. The average salary is: {promedio}");


            PositionNode position = universityTree.SearchNode(universityTree.Root, viceFinanciero.Name);

            float sumSalary2 = universityTree.SumSalaries(position);

            float count2 = universityTree.Count(position);

            Console.WriteLine($"\nP 3. The average salaries from position {position.Position.Name}" + $" is: {sumSalary2 / count2}");


            float sumTax = universityTree.SumTax(universityTree.Root);

            Console.WriteLine($"\nP 4.The total taxes are: {sumTax}");

            Console.ReadLine();
        }
Пример #13
0
        static void Main(string[] args)
        {
            Position rectorPosition = new Position();

            rectorPosition.Name   = "rector";
            rectorPosition.Salary = 1000;
            rectorPosition.Tax    = 30;


            Position vicFinPosition = new Position();

            vicFinPosition.Name   = "Vicerector Financiero";
            vicFinPosition.Salary = 750;
            vicFinPosition.Tax    = 20;


            Position contadorPosition = new Position();

            contadorPosition.Name   = "contador";
            contadorPosition.Salary = 500;
            contadorPosition.Tax    = 10;


            Position jefeFinPosition = new Position();

            jefeFinPosition.Name   = "Jefe financiero";
            jefeFinPosition.Salary = 610;
            jefeFinPosition.Tax    = 11;


            Position secFin1Position = new Position();

            secFin1Position.Name   = "Secretaría Financiera 1 ";
            secFin1Position.Salary = 350;
            secFin1Position.Tax    = 5;

            Position secFin2Position = new Position();

            secFin2Position.Name   = "Secretaría Financiera 2 ";
            secFin2Position.Salary = 310;
            secFin2Position.Tax    = 6;

            Position vicAcadPosition = new Position();

            vicAcadPosition.Name   = "Vicerector academico";
            vicAcadPosition.Salary = 780;
            vicAcadPosition.Tax    = 8;

            Position jefeRegPosition = new Position();

            jefeRegPosition.Name   = "Jefe de Registro";
            jefeRegPosition.Salary = 640;
            jefeRegPosition.Tax    = 9;

            Position sectReg2 = new Position();

            sectReg2.Name   = "Secretario de registro 2";
            sectReg2.Salary = 360;
            sectReg2.Tax    = 17;

            Position sectReg1 = new Position();

            sectReg1.Name   = "Secretario de registro 1";
            sectReg1.Salary = 400;
            sectReg1.Tax    = 16;

            Position asist2 = new Position();

            asist2.Name   = "Asistente 2";
            asist2.Salary = 170;
            asist2.Tax    = 25;

            Position asist1 = new Position();

            asist1.Name   = "Asistente 1";
            asist1.Salary = 250;
            asist1.Tax    = 26;

            Position mensajero = new Position();

            mensajero.Name   = "mensajero";
            mensajero.Salary = 90;
            mensajero.Tax    = 27;

            UniversityTree universityTree = new UniversityTree();

            universityTree.CreatePosition(null, rectorPosition, null);

            universityTree.CreatePosition(universityTree.Root, vicFinPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, contadorPosition, vicFinPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin1Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, secFin2Position, contadorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeFinPosition, vicFinPosition.Name);


            universityTree.CreatePosition(universityTree.Root, vicAcadPosition, rectorPosition.Name);
            universityTree.CreatePosition(universityTree.Root, jefeRegPosition, vicAcadPosition.Name);
            universityTree.CreatePosition(universityTree.Root, sectReg2, jefeRegPosition.Name);
            universityTree.CreatePosition(universityTree.Root, sectReg1, jefeRegPosition.Name);
            universityTree.CreatePosition(universityTree.Root, asist2, sectReg1.Name);
            universityTree.CreatePosition(universityTree.Root, asist1, sectReg1.Name);
            universityTree.CreatePosition(universityTree.Root, mensajero, asist2.Name);

            universityTree.PrintTree(universityTree.Root);
            Console.WriteLine("Total salaries = " + universityTree.addSalaries(universityTree.Root));


            Console.WriteLine(" *-----------↑↑↑↑ First delivery ↑↑↑↑ ------------*");
            Console.WriteLine(" *-----------↓↓↓↓ Second delivery ↓↓↓↓------------*");

            int TotalNodes = universityTree.Node(universityTree.Root);

            universityTree.AddHigherSalary(universityTree.Root);
            float AverageSalary = universityTree.AvarageSalary(universityTree.Root, TotalNodes);

            Console.WriteLine("Higher salary  = " + universityTree.getHigherSalary());
            Console.WriteLine("Average salary  = " + AverageSalary);
            Console.WriteLine("The total Tax is = " + universityTree.AddTax(universityTree.Root));
            Console.WriteLine("Write name to search");
            string name = Console.ReadLine();

            Console.WriteLine(" the position salary is entered = " + universityTree.PositionSalary(universityTree.Root, name));
            Console.ReadLine();
        }