

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Create a class MathOperations , which should have 3 times method Add(). Method Add() have to be invoked with: Add(int, int): int Add(double, double, double): double Add(decimal, decimal, decimal): decimal You should be able to use the class like this: StartUp.cs public static void Main() { MathOperations mo = new MathOperations(); Console.WriteLine(mo.Add(2, 3)); Console.WriteLine(mo.Add(2.2, 3.3, 5.5)); Console.WriteLine(mo.Add(2.2m, 3.3m, 4.4m)); }
Input Output 5 11
The MathOperation class should look like this:
Create a class Animal , which hold two properties : Name : string FavouriteFood : string
Animal have one virtual method ExplainSelf(): string You should add two new classes Cat and Dog. There override ExplainSelf() method by adding concrete animal sound on new line. (Look at examples below) You should be able to use the class like this: StartUp.cs Animal cat = new Cat("Pesho", "Whiskas"); Animal dog = new Dog("Gosho", "Meat"); Console.WriteLine(cat.ExplainSelf()); Console.WriteLine(dog.ExplainSelf());
Input Output I am Pesho and my favourite food is Whiskas MEEOW I am Gosho and my fovourite food is Meat DJAAF
3. Shapes Create class hierarchy, starting with abstract class Shape: Abstract methods: