Output:
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Question_4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Question_4.Book R = new Question_4.Book();
MessageBox.Show("The Area Of Rectangle : "+ R.Area(15,25));
}
private void button2_Click(object sender, EventArgs e)
{
Question_4.Book S = new Question_4.Book();
MessageBox.Show("The Area Of Circle : " + S.Area(18));
}
private void button3_Click(object sender, EventArgs e)
{
Question_4.Book C = new Question_4.Book();
MessageBox.Show("The Area Of Circle :" + C.Area(18.22f));
}
}
}
Book Class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Question_4
{
public class Book
{
static double pi = 3.14;
public int Area(int Length, int Width)
{
return Length * Width;
}
public int Area(int Length)
{
return Length * Length;
}
public double Area(float radius)
{
return pi * radius * radius;
}
}
}
No comments:
Post a Comment