作业代码1
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了作业代码1相关的知识,希望对你有一定的参考价值。
<?php
/**
* Created by PhpStorm.
* User: fu
* Date: 2017/7/18
* Time: 11:38
*/
/*
* 周末练习:
1 根据描述定义出对应的功能类、接口等:
银行柜台常规的功能有:存款、取款、转账、查询、修改密码等;
ATM机也具有类似的功能:存款、取款、转账、查询、修改密码等;
但是银行柜台可以人工操作服务。
另外不同的银行可以提供一些特殊的便民服务:
中国银行可以交水、电、气等费用;
建设银行可以交水、电费,同时还可以交上网费;
交通银行可以交水费,还可以交交通违章费用;
工商银行可以交电、气费,还可以交有线电视费;
另外现在网络也和发达,那么支付宝和微信都可以支持上面的特殊费用的提交。
那么请大家根据上面的描述来进行设计。
*/
abstract class YinHang{
private $yinHangMingChen;
private $yinHangZhangHao;
private $miMa;
public function cunKuan(){
}
public function quKuan(){
}
public function zhuanZhang(){
}
public function chaXun(){
}
public function xiuGaiMiMa(){
}
}
interface IShui{
function jiaoShuiFei();
}
interface IDian{
function jiaoDianFei();
}
interface IQi{
function jiaoQiFei();
}
interface IShangWang{
function jiaoShangWangFei();
}
interface IWeiZhang{
function jiaoWeiZhangFei();
}
interface IDianShi{
function jiaoDianShiFei();
}
class ZhongGuoYinHang extends YinHang implements IShui,IDian,IQi {
function jiaoShuiFei(){
}
function jiaoDianFei(){
}
function jiaoQiFei(){
}
}
class JianSheYinHang extends YinHang implements IShui,IDian,IShangWang{
function jiaoDianFei()
{
// TODO: Implement jiaoDianFei() method.
}
function jiaoShangWangFei()
{
// TODO: Implement jiaoShangWangFei() method.
}
function jiaoShuiFei()
{
// TODO: Implement jiaoShuiFei() method.
}
}
class JiaoTongYinHang extends YinHang implements IShui, IWeiZhang{
function jiaoShuiFei()
{
// TODO: Implement jiaoShuiFei() method.
}
function jiaoWeiZhangFei()
{
// TODO: Implement jiaoWeiZhangFei() method.
}
}
class GongShangYinHang extends YinHang implements IDian, IQi, IDianShi{
function jiaoDianFei()
{
// TODO: Implement jiaoDianFei() method.
}
function jiaoDianShiFei()
{
// TODO: Implement jiaoDianShiFei() method.
}
function jiaoQiFei()
{
// TODO: Implement jiaoQiFei() method.
}
}
class RenGongGuiTai{
private $yinHang;
public function __construct($yinHang)
{
$this->yinHang = $yinHang;
}
public function renGongFuWu(){
echo ‘人工柜台可以提供人工服务‘;
}
}
class ATM{
private $yinHang;
public function __construct($yinHang)
{
$this->yinHang = $yinHang;
}
}
abstract class WangLuoZhiFu implements IDianShi,IDian,IQi,IWeiZhang,IShui,IShangWang {
private $name;
private $zhangHao;
private $miMa;
public function __construct($name)
{
$this->name = $name;
}
function jiaoQiFei()
{
// TODO: Implement jiaoQiFei() method.
}
function jiaoDianShiFei()
{
// TODO: Implement jiaoDianShiFei() method.
}
function jiaoDianFei()
{
// TODO: Implement jiaoDianFei() method.
}
function jiaoWeiZhangFei()
{
// TODO: Implement jiaoWeiZhangFei() method.
}
function jiaoShuiFei()
{
// TODO: Implement jiaoShuiFei() method.
}
function jiaoShangWangFei()
{
// TODO: Implement jiaoShangWangFei() method.
}
}
class ZhiFuBao extends WangLuoZhiFu{
}
class WeiXin extends WangLuoZhiFu{
}
以上是关于作业代码1的主要内容,如果未能解决你的问题,请参考以下文章