- 클래스 다이어그램과 속성울 참고하여 코드 구현하기
package com.inheritance;
public class Customer {
private int customerID;
private String customerName;
private String customerGrade;
private int bonusPoint;
private double bonusRatio;
public Customer() {
}
public int calPrice(int p){
return 0;
}
public void showCustomerInfo() {
System.out.println("고객 아이디");
System.out.println("고객 이름");
System.out.println("고객 등급");
}
}
package com.inheritance;
public class VIPCustomer extends Customer {
private int agentID;
private double salesRatio;
public VIPCustomer( ) {
}
public int getAgentID() {
return 0;
}
}
'JAVA' 카테고리의 다른 글
포함 관계 연습문제 (0) | 2025.04.25 |
---|---|
포함 관계(composition) (0) | 2025.04.25 |
상속을 활용한 Hero 코드 만들기 (0) | 2025.04.25 |
상속과 오버라이드 (0) | 2025.04.25 |
상속(inheritance) (0) | 2025.04.25 |