码迷,mamicode.com
首页 > 其他好文 > 详细

银行卡系统

时间:2015-08-15 00:05:06      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:

package oo.day06;
//银行卡系统
public class UnionPayTest {
public static void main(String[] args) {
ICBCImpl icbc1 = new ICBCImpl();
ICBC icbc2 = new ICBCImpl(); //向上造型
UnionPay icbc3 = new ICBCImpl(); //向上造型
}
}

interface UnionPay{ //银联接口
public double getBalance(); //查询余额
public boolean drawMoney(double number); //取钱
public boolean checkPwd(String input); //检查密码
}
interface ICBC extends UnionPay{ //工行接口
public void payOnline(double number); //在线支付
}
interface ABC extends UnionPay{ //农行接口
public boolean payTelBill(String phoneNum,double sum); //支付电话费
}
class ICBCImpl implements ICBC{ //工行卡
public double getBalance(){return 0.0;}
public boolean drawMoney(double number){return false;}
public boolean checkPwd(String input){return false;}
public void payOnline(double number){}
}
class ABCImpl implements ABC{ //农行卡
public double getBalance(){return 0.0;}
public boolean drawMoney(double number){return false;}
public boolean checkPwd(String input){return false;}
public boolean payTelBill(String phoneNum,double sum){return false;}
}

 

银行卡系统

标签:

原文地址:http://www.cnblogs.com/xiaziteng/p/4731410.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!