Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace console
- {
- class Dog : Animal
- {
- public Dog(string type, string family, string fell, int legs, bool tail, int weight, int height, string food) : base(type, family, fell, legs, tail,weight,height, food)
- {
- }
- public static Dog operator *(Dog dog1, Dog dog2)
- {
- Random rnd = new Random();
- int key = rnd.Next(0, 1);
- string type, family, fell, food;
- int legs, weight, height;
- bool tail;
- if (key == 0) { type = dog1.Type; }
- else { type = dog2.Type; }
- key = rnd.Next(0, 1);
- if (key == 0) { family = dog1.Family; }
- else { family = dog2.Family; }
- key = rnd.Next(0, 1);
- if (key == 0) { fell = dog1.Fell; }
- else { fell = dog2.Fell; }
- legs = dog1.Legs;
- key = rnd.Next(0, 1);
- if (dog1.Tail == dog2.Tail) { tail = dog1.Tail; }
- else if (key == 0) { tail = dog1.Tail; }
- else { tail = dog2.Tail; }
- weight = (int)((dog1.Weight + dog2.Weight) / 2);
- height = (int)((dog1.Height + dog2.Height) / 2);
- key = rnd.Next(0, 1);
- if (key == 0) { food = dog1.Food; }
- else { food = dog2.Food; }
- var dog = new Dog(type, family, fell, legs, tail, weight, height, food);
- return dog;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement