Esempio n. 1
0
        public void GradinaZoologica()
        {
            Dog      dog       = new Dog("Patrocle", 50, 55, 6, 50);
            Employee zooKeeper = new Employee(/*Gender.male, "Femele", null, "", null, 0, null, false*/);

            zooKeeper.AdoptPet(dog);
            Dog dog2 = new Dog("Patrocle2", 50, 55, 6, 50);

            zooKeeper.AdoptPet(dog2);
            Croc Croky = new Croc("Croky");

            Console.WriteLine("Croky status");
            Croky.ShowStatus();
            Croky.Swim();
            Console.WriteLine("Croky status after swimming");
            Croky.ShowStatus();
            Croky.Feed();
            Croky.GrowOlder();
            Croky.Move();
            Croky.Talk();
            zooKeeper.AdoptPet(Croky);
            zooKeeper.AdoptPet(new Cat()
            {
                Colour = Colour.Black
            });
            zooKeeper.AdoptPet(new Lion());
            zooKeeper.AdoptPet(new Chicken());
            zooKeeper.AdoptPet(new Swan(0, 0, 0, 0));
            zooKeeper.AdoptPet(new Cioara("Ciordeles", 50, 1, (int)(Math.Pow(Math.E, Math.PI))));
            foreach (var pet in zooKeeper.Pets)
            {
                pet.Feed();
                pet.GrowOlder();
                pet.Move();
                pet.Talk();
                Console.WriteLine(pet.ToString());
            }
            Console.WriteLine("Croky status");
            Croky.ShowStatus();
            var crocky      = zooKeeper.Pets[2];
            var crockyCroco = (Croc)crocky;

            Console.WriteLine("crockyCroco status");
            crockyCroco.ShowStatus();
            crockyCroco.Swim();
            Console.WriteLine("crockyCroco status after swimming");
            crockyCroco.ShowStatus();
            Console.WriteLine("Croky status after crockyCroco swimmed");
            Croky.ShowStatus();
            var Bismarck = new Croc("Bismarck");

            Console.WriteLine("Acroc status");
            Bismarck.ShowStatus();
            Bismarck.Swim();
            Console.WriteLine("Acroc status after swimming");
            Bismarck.ShowStatus();
            Console.WriteLine("Croky status after Acroc swimmed");
            Croky.ShowStatus();
            //var cutuCroco = (Croc)zooKeeper.Pets[1];
            //cutuCroco.ShowStatus();
            //cutuCroco.Swim();
            Console.WriteLine(Math.Log10(12345));
            var logaritm = Math.Log(Math.E);
        }
Esempio n. 2
0
        public static void Main(string[] args)
        {
            new Exercitii().GradinaZoologica();
            var fierari = new Car("", "", null, 0);

            AfisareMasini(new Car[] { fierari });
            fierari.Colour = Colour.Red;
            fierari.Make   = "fierari";
            fierari.Model  = "F40";
            var oltcit = new Car("Oltcit", "", null, Colour.White);

            Car[] masini = new Car[] { fierari, oltcit, new Car("mergedes", "GLX", new Engine(Fuel.Diesel, 184, 2500, "AMG", 0), Colour.Silver) };
            AfisareMasini(masini);
            oltcit.Paint(Colour.Silver);
            AfisareMasini(masini);
            var translator = new Translator();
            var n          = 7;

            Console.WriteLine("numarul este " + n);
            string sn = translator.RomanianNumber(n);

            Console.WriteLine("in romana este " + sn);
            sn = translator.DictionarRoEng(sn);
            Console.WriteLine(sn);
            sn = translator.TransformIntToString(n);
            Console.WriteLine(sn);
            sn = translator.Convert(n);
            Console.WriteLine("romana metoda Dianei2 " + sn);
            Class o1 = new Class();

            o1.Name    = "Intermediari";
            o1.Points  = 3;
            o1.Teacher = new Teacher()
            {
                Car = masini[2]
            };
            Gender o2 = Gender.female;
            Fuel   o3 = Fuel.Electric;

            o1.Teacher.Gender     = o2;
            masini[2].Engine.Fuel = o3;
            Student s1 = new Student(Gender.male, "", null, "", null, 0, null, false, null, 0, null);

            s1.Name     = "Nume Student";
            s1.Blacklog = new List <Class>();
            s1.Blacklog.Add(new Class()
            {
                Name = "materia 1", Points = 5
            });
            s1.Blacklog.Add(new Class()
            {
                Name = "materia 2"
            });

            s1.Gender  = Gender.female;
            s1.Address = new Address()
            {
                Town = "Bucuresti", Street = "Splai", Nr = 290
            };
            s1.PhoneNumber = "0721000122";
            s1.Year        = 3;
            s1.Grades      = new Dictionary <Class, int>();
            s1.Grades.Add(new Class()
            {
                Name = "materia 3", Points = 5
            }, 10);
            s1.Grades.Add(new Class()
            {
                Name = "materia 4", Points = 10
            }, 5);
            s1.Car = masini[0];
            Console.WriteLine(s1.Name + " gen: " + s1.Gender + " phone " + s1.PhoneNumber + " an " + s1.Year);
            Console.WriteLine("Adresa: " + s1.Address.Town + " " + s1.Address.Street + " " + s1.Address.Nr);
            Console.Write("Restante: ");
            foreach (var r in s1.Blacklog)
            {
                Console.WriteLine(r.Name + " " + r.Points);
            }
            Console.WriteLine();

            foreach (var item in s1.Grades)
            {
                Console.WriteLine(item.Key.Name + " " + item.Key.Points + " " + item.Value);
            }
            Dog dog = new Dog("Patrocle", 50, 55, 6, 50);

            dog.GrowOlder();

            Console.WriteLine(dog.Age);

            Person person = new Person(Gender.male, "Femele", null, "", null, 0, null, false);
            //person.AdoptPet(dog);

            Dog dog2 = new Dog("Patrocle2", 50, 55, 6, 50);

            Console.WriteLine("Patrocle2: " + dog2.Id);
            //Console.WriteLine(person.Pets.Count);
            Employee Andrei = new Employee();

            Andrei.Department = "HR";
            Andrei.Position   = "Schef";
            Andrei.Skil       = "";
            Andrei.Name       = "Andrei";
            Andrei.WriteEmployee();
            Croc Croky = new Croc("Croky");

            Croky.Feed();
            Croky.GrowOlder();
            Croky.Move();
            Croky.Talk();

            /*
             * Cat pisicuta = new Cat();
             * pisicuta.EatAnimal();
             */
            Console.ReadKey();
        }