-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRectangle.java
77 lines (56 loc) · 980 Bytes
/
Rectangle.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
public class Rectangle
{
private int length; //instance
private int breadth; //instance
private static int count; //class
public Rectangle() //default constructor
{
length=2;
breadth=2;
count++;
}
public Rectangle(int a,int b) //paramatrized constructor
{
length=a;
breadth=b;
count++;
}
public void setRectangleDimension(int a,int b) //setter
{
length=a;
breadth=b;
}
public void setLength(int a) //setter
{
length=a;
}
public void setBreadth(int b) //setter
{
breadth=b;
fv
}
public String getRectangleDimension() //getter
{
return length +" "+ breadth;
}
public int getLength() //getter
{
return length;
}
public int getBreadth() //getter
{
return breadth;
}
public int rectangleArea(int l ,int b) //Bussiness logic
{
return l*b;
}
public static int count() //count
{
return count;
}
public String toString() //toString
{
return(length+" "+breadth);
}
}