Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace facebookgroup
- {
- class Aspirante
- {
- private int edad;
- private bool experienciaLaboral;
- private bool esIngeniero;
- public Aspirante(int edad, bool experiencia, bool campoLaboral)
- {
- this.edad = edad;
- this.experienciaLaboral = experiencia;
- this.esIngeniero = campoLaboral;
- }
- public void datosDeAspirante()
- {
- Console.WriteLine("EDAD --> "+ edad);
- Console.WriteLine("EXPERIENCIA L ABORAL? --> " + experienciaLaboral);
- Console.WriteLine("ASPIRANTE ES INGENIERO? --> " + esIngeniero);
- }
- public int edadDeAspirante()
- {
- return edad;
- }
- public bool experienciaDeAspirante()
- {
- return experienciaLaboral;
- }
- public bool campoLaboralDeAspirante()
- {
- return esIngeniero;
- }
- }
- class ReportadorDeAspirantes
- {
- private int[] edades = {16,17,18,20,24,26};
- private Aspirante[] aspirantes;
- private Random datosAleatorios;
- public ReportadorDeAspirantes(int nroDeAspirantes)
- {
- aspirantes = new Aspirante[nroDeAspirantes];
- datosAleatorios = new Random();
- crearAspirantes();
- }
- private int edadDeAspirante()
- {
- return datosAleatorios.Next(edades[0],edades[edades.Length -1]);
- }
- private bool campoLaboral()
- {
- if (datosAleatorios.Next(2) % 2 == 0) { return true;}
- return false;
- }
- private void crearAspirantes()
- {
- for (int aspirante = 0; aspirante < aspirantes.Length; ++aspirante)
- aspirantes[aspirante] = new Aspirante(edadDeAspirante(), campoLaboral(), campoLaboral());
- }
- private bool esAspiranteAceptado(int aspirante)
- {
- return aspirantes[aspirante].edadDeAspirante() > 18 &&
- aspirantes[aspirante].experienciaDeAspirante() == true &&
- aspirantes[aspirante].campoLaboralDeAspirante() == true;
- }
- public int nroDeAspirantesAceptados()
- {
- int aspirantesAceptados = 0;
- for (int aspirante = 0; aspirante < aspirantes.Length; ++aspirante)
- if (esAspiranteAceptado(aspirante))
- ++aspirantesAceptados;
- return aspirantesAceptados;
- }
- public void datosDeAspirantes()
- {
- Console.WriteLine("\tDATOS DE ASPIRANTES \n ==============================\n");
- for (int aspirante = 0; aspirante < aspirantes.Length; ++aspirante)
- aspirantes[aspirante].datosDeAspirante();
- }
- public static void Main(String[] args)
- {
- Console.WriteLine("ingrese nro de aspirantes");
- ReportadorDeAspirantes reportadorDeAspirantes = new
- ReportadorDeAspirantes(Convert.ToInt32(Console.ReadLine()));
- Console.WriteLine("REPORTE FINALIZADO PRESION[ENTER] PARA VER RESULTADOS");
- Console.ReadLine();
- reportadorDeAspirantes.datosDeAspirantes();
- Console.WriteLine("\nNRO DE ASPIRANTES ACEPTADOS ---> " + reportadorDeAspirantes.nroDeAspirantesAceptados());
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement