-
Notifications
You must be signed in to change notification settings - Fork 0
/
Animal.cs
136 lines (108 loc) · 3.19 KB
/
Animal.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
namespace Animal;
public class Animal
{
public string AnimalName = "Default name";
public string Family = "Default family";
public int Age = 0;
public bool Carnivore = true;
public bool CanFly = true;
public Animal(string animalName, string family, int age, bool carnivore, bool canFly)
{
this.AnimalName = animalName;
this.Family = family;
this.Age = age;
this.Carnivore = carnivore;
this.CanFly = canFly;
}
public void Sleep()
{
Console.WriteLine("Time to sleep");
}
public void Eat()
{
Console.WriteLine("Time to eat");
}
public void Groom()
{
Console.WriteLine("Time to groom");
}
public virtual void makeSound()
{
Console.WriteLine("Animal makes a noise");
}
}
public class Dog : Animal
{
public string Colour = "Default colour";
public Dog(string animalName, string family, int age, bool carnivore, bool canFly, string colour) :base( animalName, family, age, carnivore, canFly)
{
this.Colour = colour;
}
public override void makeSound()
{
Console.WriteLine("Dog makes a noise");
}
public void RollOver()
{
Console.WriteLine("Dog rolls over");
}
}
public class Crocodile : Animal
{
public int NumberOfTeeth = 0;
public Crocodile(string animalName, string family, int age, bool carnivore, bool canFly, int numberOfTeeth) :base( animalName, family, age, carnivore, canFly)
{
this.NumberOfTeeth = numberOfTeeth;
}
public override void makeSound()
{
Console.WriteLine("Crocodile makes a noise");
}
public void Bite()
{
Console.WriteLine("Crocodile Bites");
}
}
public class Bird : Animal
{
public string FeatherColour = "Default colour";
public Bird(string animalName, string family, int age, bool carnivore, bool canFly, string featherColour) :base( animalName, family, age, carnivore, canFly)
{
this.FeatherColour = featherColour;
}
public override void makeSound()
{
Console.WriteLine("Bird makes a noise");
}
public void Chirp()
{
Console.WriteLine("Bird chirps");
}
}
public class Rooster : Bird
{
public string FarmName = "Default farm name";
public Rooster(string animalName, string family, int age, bool carnivore, bool canFly, string featherColour,
string farmName) : base(animalName, family, age, carnivore, canFly, featherColour)
{
this.FarmName = farmName;
}
public void Cockle()
{
Console.WriteLine("Cockledoodledooooo!");
}
}
public class Eagle : Bird
{
public string HuntingLevel = "Default hunting level";
public Eagle(string animalName, string family, int age, bool carnivore, bool canFly, string featherColour,
string huntingLevel)
: base(animalName, family, age, carnivore, canFly, featherColour)
{
this.HuntingLevel = huntingLevel;
}
public void Swoop()
{
Console.WriteLine("The eagle swoops down");
}
}