Exemplo n.º 1
0
    public static void Main()
    {
        var inhabitans = new List <IInhabitant>();
        var factory    = new InhabitantFactory();

        string input;

        while ((input = Console.ReadLine()) != "End")
        {
            inhabitans.Add(factory.CreateInhabitant(input.Split().ToArray()));
        }

        var idPart = Console.ReadLine();

        foreach (var inhabitant in inhabitans.Where(i => i.Id.EndsWith(idPart)))
        {
            Console.WriteLine(inhabitant.Id);
        }
    }
Exemplo n.º 2
0
    public static void Main()
    {
        var beings  = new List <IBeing>();
        var factory = new InhabitantFactory();

        string input;

        while ((input = Console.ReadLine()) != "End")
        {
            var being = factory.CreateBeing(input.Split());
            if (being != null)
            {
                beings.Add(being);
            }
        }

        var year = Console.ReadLine();

        foreach (var being in beings.Where(b => b.Birthdate.EndsWith(year)))
        {
            Console.WriteLine(being.Birthdate);
        }
    }
Exemplo n.º 3
0
 public Engine()
 {
     inhabitantFactory = new InhabitantFactory();
 }