This repository was archived by the owner on Dec 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBuilding.java
More file actions
85 lines (73 loc) · 1.71 KB
/
Building.java
File metadata and controls
85 lines (73 loc) · 1.71 KB
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
77
78
79
80
81
82
83
84
85
/*
* Chris Jacobs (cjacobs2)
* RandomSkyline
* Feb 28, 2011
* CS111B - TTh 11 AM - 1 PM
* Assignment: K3 and K4
*/
import java.awt.*;
public class Building {
// class building for object building, made of Brick and Windows
private int x; // x coord
private int y; // y coord
private int width; // width of building
private int height; // height of building
public Brick bricks; // brick component of building
public Windows windows; // window component of building
public Building(int theX, int theY, int wide, int tall, int multi) {
// building constructor
x = theX;
y = theY;
width = wide;
height = tall;
// create the building's bricks
bricks = new Brick(x, y, width, height, multi);
// create the buildings windows
windows = new Windows(x, y, width, height);
}
public void draw(Graphics page) {
// draw sub-parts
bricks.draw(page);
windows.draw(page);
}
public void setX(int newX) {
// x setter
bricks.setX(newX);
windows.setX(newX);
x = newX;
}
public void setY(int newY) {
// y setter
bricks.setY(newY);
windows.setY(newY);
y = newY;
}
public void setWidth(int newWidth) {
// width setter
bricks.setWidth(newWidth);
windows.setWidth(newWidth);
width = newWidth;
}
public void setHeight(int newHeight) {
// height setter
bricks.setHeight(newHeight);
windows.setHeight(newHeight);
height = newHeight;
}
public int getX() {
// x getter
return x;
}
public int getY() {
// y getter
return y;
}
public int getWidth() {
// width getter
return width;
}
public int getHeight() {
// height getter
return height;
}
}