forked from eomjinyoung/JavaWebProgramming
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCar.java
More file actions
63 lines (50 loc) · 1.13 KB
/
Car.java
File metadata and controls
63 lines (50 loc) · 1.13 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
package exam.test15;
import java.util.Map;
public class Car {
String model; // 모델명
Engine engine; // 엔진
Tire[] tires; // 타이어
Map<String,Object> options; //선택사항
public Car() {}
public Car(String model, Engine engine) {
this.model = model;
this.engine = engine;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public Engine getEngine() {
return engine;
}
public void setEngine(Engine engine) {
this.engine = engine;
}
public Tire[] getTires() {
return tires;
}
public void setTires(Tire[] tires) {
this.tires = tires;
}
public Map<String, Object> getOptions() {
return options;
}
public void setOptions(Map<String, Object> options) {
this.options = options;
}
@Override
public String toString() {
StringBuffer carInfo = new StringBuffer();
carInfo.append("[Car:" + model);
carInfo.append("\n " + engine.toString());
if (tires != null) {
for (Tire tire : tires) {
carInfo.append("\n " + tire.toString());
}
}
carInfo.append("\n]");
return carInfo.toString();
}
}