class Rectangle
{
int l,b;
Rectangle(int x,int y)
{
l=x;
b=y;
}
int getRectangle()
{
return l*b;
}
}
class Triangle extends Rectangle
{
float a;
Triangle(int v,int u)
{
super(u,v);
}
float getTriangle()
{
a=(float)l/2*l*b;
return (a);
}
}
class RectangleTriangle
{
public static void main(String args[])
{
Triangle m=new Triangle(500,80);
System.out.println("Area of Rectangle is : " +m.getRectangle());
System.out.println("Area of Triangle is : "+m.getTriangle());
}
}
Dinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular Computer Notes blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.
Related Articles
Basic Courses
Advance Courses