2013년 2월 26일 화요일

7일차- 배열2

public class CarFactoryMain {


public static void main(String[] args) {

Car matiz = new Car();
matiz.setModel("matiz");
matiz.setDoorCount(4);

Engine mEngine = new Engine();
mEngine.setType("A");
mEngine.setCc(1000);
matiz.setEngine(mEngine);

matiz.print();

}

}
----------------------------------------------------

public class Car {

private String model;
private int doorCount;
/****engine****/
private Engine engine;
/**************/

public void setData(String model, int doorCount, Engine engine){
this.model=model;
this.doorCount=doorCount;
this.engine=engine;
}
public void print(){
System.out.println("모델:"+this.model);
System.out.println("문수:"+this.doorCount);
/*
System.out.println("엔진타입:"+this.engine.getType());
System.out.println("엔진배기량:"+this.engine.getCc());
*/
engine.print();
}
/*
public String getInfo(){
return ""+model+"\t"+doorCount+"\t"+"engine";
}
*/
public void setEngine(Engine engine)  {
this.engine=engine;
}
public Engine getEngine()  {
return this.engine;
}
public String getModel() {
return model;
}

public void setModel(String model) {
this.model = model;
}

public int getDoorCount() {
return doorCount;
}

public void setDoorCount(int doorCount) {
this.doorCount = doorCount;
}
}
--------------------------------------------------------
public class Engine {

private String type;//엔진의 타입
private int cc;  //엔진의 배기량
public void print(){
System.out.println(this.type);
System.out.println(this.cc);
/*
* String getInfo = this.getInfo();
*
*System.out.println(getInfo);
*/
}
/*
public String getInfo()  {
return type+"\t"+cc;
}
*/
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public int getCc() {
return cc;
}
public void setCc(int cc) {
this.cc = cc;
}
}

댓글 3개:

국정원의 댓글 공작을 지탄합니다.

대학원생의 투고 지도 ④ (완결) — 논문의 수준이란 무엇인가: 사다리와 사분위, 첫 논문 전략

완결편이다. "논문 수준"이라는 말을 해부하고, 에듀테크 석사생의 첫 논문 전략으로 마친다. 학위논문과 학술지 논문은 다른 장르다 먼저 가장 흔한 혼동부터. 학위논문(thesis)은 "내가 연구를 수행할 줄 안다...