static void Main(string[] args) { // Every animal has a hunger value, which is a whole number // Every animal has a thirst value, which is a whole number // when creating a new animal object these values are created with the default 50 value // Every animal can eat() which decreases their hunger by one // Every animal can drink() which decreases their thirst by one // Every animal can play() which increases both by one var dog = new Animal("Dog", 50, 50); dog.Drink(); dog.Eat(); dog.Play(); Console.WriteLine(dog.GetThirst()); Console.WriteLine(dog.GetHunger()); var cat = new Animal("Cat", 50, 50); dog.Play(); Console.WriteLine(dog.GetThirst()); Console.WriteLine(dog.GetHunger()); Console.ReadKey(); }
static void Main(string[] args) { Animal tiger = new Animal(); tiger.Eat(); tiger.Play(); tiger.Drink(); Console.Read(); }
static void Main(string[] args) { Animal zebraallat = new Animal(); Console.WriteLine(zebraallat.hunger + " " + zebraallat.thirst); zebraallat.Eat(); zebraallat.Drink(); Console.WriteLine(zebraallat.hunger + " " + zebraallat.thirst); zebraallat.Play(); Console.WriteLine(zebraallat.hunger + " " + zebraallat.thirst); Console.ReadLine(); }
static void Main(string[] args) { Animal camel = new Animal(); Console.WriteLine(camel.Drink()); Console.WriteLine(camel.Eat()); foreach (var item in camel.Play()) { Console.WriteLine(item); } Console.ReadLine(); }
static void Main(string[] args) { var Animal = new Animal(); Console.WriteLine("Current hunger level: {0}", Animal.Hunger); Console.WriteLine("Current thirst level: {0}", Animal.Thirst); Animal.Eat(); Console.WriteLine("Let's eat! The current hunger level is: {0}", Animal.Hunger); Animal.Drink(); Console.WriteLine("Let's drink! The current thirst level is: {0}", Animal.Thirst); Animal.Play(); Console.WriteLine("Let's play! The current hunger and thirst level is: {0} , {0}", Animal.Hunger, Animal.Thirst); Console.ReadLine(); }
static void Main(string[] args) { var tiger = new Animal(50, 50); tiger.Drink(); tiger.Eat(); tiger.Play(); tiger.Play(); tiger.Play(); Console.WriteLine("The tiger's hunger is: " + tiger.GetHunger() + " and the tiger thirth is: " + tiger.GetThirst()); Console.ReadLine(); }
static void Main(string[] args) { //Create an Animal class //Every animal has a hunger value, which is a whole number //Every animal has a thirst value, which is a whole number //when creating a new animal object these values are created with the default 50 value //Every animal can eat() which decreases their hunger by one //Every animal can drink() which decreases their thirst by one //Every animal can play() which increases both by one Animal dog = new Animal(); Animal cat = new Animal(); Console.WriteLine(dog.Drink()); Console.ReadLine(); }
static void Main(string[] args) { Animal tiger = new Animal(50, 50); Animal dog = new Animal(50, 50); tiger.Drink(); dog.Play(); dog.Eat(); dog.Drink(); dog.Play(); dog.Play(); dog.Play(); dog.Play(); Console.WriteLine("Hunger level of your Tiger: {0}", tiger.thirst); Console.WriteLine($"Thirst level of yor dog: {dog.thirst}"); Console.WriteLine(dog.hunger); Console.ReadLine(); }
static void Main(string[] args) { Animal giraffe = new Animal(); Animal lion = new Animal(); Console.WriteLine("How many leaves are there for Mr. Giraffe?"); int leaves = int.Parse(Console.ReadLine()); Console.WriteLine("How many sirloin steaks are there for Ms. Lion?"); int steaks = int.Parse(Console.ReadLine()); Console.WriteLine("How many lakes are there?"); int lakes = int.Parse(Console.ReadLine()); Console.WriteLine("For how many rounds should Ms. Lion chase Mr. Giraffe?"); int rounds = int.Parse(Console.ReadLine()); for (int i = 0; i < leaves; i++) { giraffe.Eat(); } for (int i = 0; i < steaks; i++) { lion.Eat(); } for (int i = 0; i < lakes; i++) { giraffe.Drink(); lion.Drink(); } for (int i = 0; i < rounds; i++) { giraffe.Play(); lion.Play(); } Console.WriteLine($"Mr. Giraffe is now {giraffe.GetHunger()}% hungry and {giraffe.GetThirst()}% thirsty"); Console.WriteLine($"Mr. Giraffe is now {lion.GetHunger()}% hungry and {lion.GetThirst()}% thirsty"); Console.ReadLine(); }
static void Main(string[] args) { Animal firstAnimal = new Animal(); Console.WriteLine("Hunger level of the animal is: " + firstAnimal.Eat() + "\n" + "Thirst level of the animal is: " + firstAnimal.Drink()); foreach (var item in firstAnimal.Play()) { Console.WriteLine("Hunger and thirst level after play: " + item); } Console.ReadLine(); }