class Pencil{
String color;
void write() {
System.out.println(color+"연필로 적습니다.");
}
}
class Eraser{
String type;
void eraser() {
System.out.println(type+"지우개로 지웁니다.");
}
}
class Pen{
String color;
String type;
void write() {
System.out.println("제조사가 " +type+"에"+color
+"펜으로 적습니다.");
}
}
public class Q2 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Pencil p1 = new Pencil();
Pencil p2 = new Pencil();
Pencil p3 = new Pencil();
Pencil p4 = new Pencil();
p1.color = "빨간";
p2.color = "파란";
p3.color = "주황";
p4.color = "노란";
Eraser e1 = new Eraser();
Eraser e2 = new Eraser();
e1.type = "잠자리";
e2.type = "모닝글로리";
Pen pen1 = new Pen();
Pen pen2 = new Pen();
Pen pen3 = new Pen();
pen1.color="검정색";
pen1.type="모나미";
pen2.color="초록색";
pen2.type="제트스트림";
pen3.color="베이비블루";
pen3.type="워터맨";
p1.write();
p2.write();
p3.write();
p4.write();
e1.eraser();
e2.eraser();
pen1.write();
pen2.write();
pen3.write();
}
}