-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRectangle.java
76 lines (71 loc) · 1.41 KB
/
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
// -------------------------------------------------------------------------
/**
* Rectangle properties
*
* @author Paco
* @version Feb 3, 2016
*/
public class Rectangle
{
//Field-------------------------------------------------------------
private int x;
private int y;
private int w;
private int h;
// ----------------------------------------------------------
/**
* Create a new Rectangle object.
* @param xp xpos
* @param yp ypos
* @param wp width
* @param hp height
*/
public Rectangle(int xp, int yp, int wp, int hp)
{
x = xp;
y = yp;
w = wp;
h = hp;
}
//Methods-----------------------------------------------------------
/**
* Get x value of rect
* @return x value
*/
public int getX()
{
return x;
}
/**
* Get y value of rect
* @return y value
*/
public int getY()
{
return y;
}
/**
* Get width
* @return w width
*/
public int getW()
{
return w;
}
/**
* Get height
* @return h height
*/
public int getH()
{
return h;
}
/**
* concatenates strings together.
* @return toString
*/
public String toString()
{
return x + ", " + y + ", " + w + ", " + h;
}
}