Ejemplo n.º 1
0
        private static void Exercise4()
        {
            ConsoleAppPrintUtil.PrintTextWithLineSeparator("Ejercicio 4:", useReadLine: false);

            var person1 = CreatePerson(name: "Persona 1", age: 50, sex: 'M');

            var person2 = CreatePerson(name: "Persona 2", age: 60, sex: 'M');

            var person3 = CreatePerson(name: "Persona 3", age: 70, sex: 'F');

            ConsoleAppPrintUtil.PrintText("Personas creadas: ", useConsoleClear: false, useReadLine: false);
            ConsoleAppPrintUtil.PrintWriteLineEmpty();

            ConsoleAppPrintUtil.PrintText(GetPersonText(person1), useConsoleClear: false, useReadLine: false);
            ConsoleAppPrintUtil.PrintText(GetPersonText(person2), useConsoleClear: false, useReadLine: false);
            ConsoleAppPrintUtil.PrintText(GetPersonText(person3), useConsoleClear: false, useReadLine: false);

            ConsoleAppPrintUtil.PrintWriteLineEmpty();

            var higherPerson = person1 > person2;

            ConsoleAppPrintUtil.PrintText($"Entre la persona 1 y 2 la mayor es: {higherPerson}", useConsoleClear: false, useReadLine: false);
            var lowerPerson = person1 < person3;

            ConsoleAppPrintUtil.PrintText($"Entre la persona 1 y 3 la menor es: {lowerPerson}", useConsoleClear: false, useReadLine: false);
            var equalsSex = person1 == person3 ? "Si" : "No";

            ConsoleAppPrintUtil.PrintText($"Las personas 1 y 3 tienen el mismo sexo: {equalsSex}", useConsoleClear: false, useReadLine: false);
            var differentSex = person2 != person3 ? "Si" : "No";

            ConsoleAppPrintUtil.PrintText($"Las personas 2 y 3 tienen diferentes sexo: {differentSex}", useConsoleClear: false);
        }