Language/Java 예제
[Java예제] 일반화,오버라이딩 예제
나비와꽃기린
2015. 1. 30. 12:34
package hw0425;
public class Prob3 {
public static void main(String[] args) {
CellPhone cellPhone=new CellPhone("010-010-010",1000);
cellPhone.call("017-017-017",10);
cellPhone.call("016-016-016",10);
cellPhone.calculateTotalFee();
System.out.println(cellPhone.getPhoneNumber()+"의 통화시간은"+
cellPhone.getTotalCallTime()+"분 이며\n"+
"단가"+cellPhone.getFeePerCallTime()+
"총요금은"+cellPhone.getTotalFee()+"원 입니다.");
System.out.println("==========================================");
SmartPhone smartPhone=new SmartPhone("000-000-000",200);
smartPhone.call("017-017-017",10);
smartPhone.calculateTotalFee();
System.out.println(smartPhone.getPhoneNumber()+"의 통화시간은"+
smartPhone.getTotalCallTime()+"분 이며\n"+
"단가"+smartPhone.getFeePerCallTime()+
"총요금은"+smartPhone.getTotalFee()+"원 입니다.");
System.out.println("==========================================");
SmartPhone smartPhone01=new SmartPhone("111-111-111",0,true,3000);
smartPhone01.call("017-017-017",10);//됨
smartPhone01.call("016-016-016",10);//됨
smartPhone01.calculateTotalFee();
System.out.println(smartPhone01.getPhoneNumber()+"의 통화시간은"+
smartPhone01.getTotalCallTime()+"분 이며\n"+
"단가"+smartPhone01.getFeePerCallTime()+
"총요금은"+smartPhone01.getTotalFee()+"원 입니다.");
}
}