TASK1
TASK2
TASK3
//This is an Example for creating a class in C#
using System;
class Areas
{
//use this function to caluclate the area for a circle
public static double CircularArea(double radius)
{
return radius * radius * 3.14;
}
}
public class Program
{
static void Main()
{
Console.WriteLine("Area of the Circle is : " + Areas.CircularArea(5));
}
}
//This is an example for creating a class in C++
#include <iostream>
class Areas
{
public:
static double CircularArea(double radius)
{
return radius * radius * 3.14;
}
};
int main()
{
std::cout << Areas::CircularArea(5) << std::endl;
/* OR, I will illustrate the difference between them next lecture
Areas A;
std::cout << A.CircularArea(5) << std::endl;
*/
return 0;
}
TASKS
1 - Create a class with the following functions :-
1 - Function to return the Area of a circle
2 - Function to return the circumference of a circle
3 - Function to return the Area of a Square
4 - Function to return the circumference of a square
5 - Function to return the Area of a rectangle
6 - Function to return the circumference of rectangle
2 - Create a class with the following functions :-
1 - Function that takes two numbers X & Y and return XY
public static int Power(int X, int Y)
{ Your Code }
2 - Function that takes a number and return True if the number is Even
and false if the number is odd
public static bool IsEven(int number)
{ Your Code }
Next Lecture, Wednesday 1 PM