
1.
평가 기준
1) TVCR과 VCR이 has-a 관계를 맺고 있는가?
2) IVCR을 implements 했는가?
3) IVCR의 추상 메서드를 VCR의 인스턴스 메서드로 적절히 구현하였는가?
코드 : 교재 299페이지
2.
평기 기준
1) String을 int 형으로 적절히 바꿀 수 있는가?
2) 예외처리를 할 수 있는가?
static int divide(String a, String b){
int result=0;
try{
result = Integer.parseInt(a)/Integer.parseInt(b);
}catch(ArithmeticException ae){
System.out.println("ArithmetciException 발생");
}catch(NumberFormatException nfe){
System.out.println("NumberForamtException 발생");
}
return result;
}
============================================================
static int divide(String a, String b) throws ArithmeticException, NumberFormatException{
return Integer.parseInt(a)/Integer.parseInt(b);
}
ArithmeticException이나 NumberFormatException 대신 RuntimeException이나 Exception으로 처리해도 무방