class
rectangle
{
private int len,bre;
public void setrect(int l,int b)
{
len = l;
bre = b;
}
public int totlen(rectangle t)
{
return len + t.len;
}
public int totbre(rectangle t)
{
return bre + t.bre;
}
rectangle combine(rectangle t)
{
rectangle temp = new rectangle();
temp.len = len + t.len;
temp.bre = bre + t.bre;
return temp;
}
public void disp()
{
System.out.println("Length
: " + len + "\t Breadth : " + bre);
}
public static void main(String args[])
{
rectangle r1 = new rectangle();
rectangle r2 = new rectangle();
rectangle r3 = new rectangle();
r1.setrect(2,3);
r2.setrect(4,5);
int tlen = r1.totlen(r2);
int tbre = r1.totbre(r2);
r3 = r1.combine(r2);
System.out.println("Total
length : " + tlen);
System.out.println("Total
Breadth : " + tbre);
r1.disp();
r2.disp();
r3.disp();
}
}
If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!
1 comments:
Casinos Near Casinos Near Casinos in LA, TX
1. Closest Casinos to Casinos Near 보령 출장마사지 Me · 2. Hollywood Casino Baton Rouge (Louisiana) 고양 출장안마 · 오산 출장마사지 3. Chouteau Casino 강릉 출장마사지 (Louisiana) · 4. Sugarhouse Casino (Louisiana) 의정부 출장샵
Have any question? Feel Free To Post Below: