一道.net编程题

<script type="text/javascript"> // </script>

朋友ANT给了个题目做
要求:(环境 VS2003+MSSQLServer2000)
    编写一个银行客户类,要求有基本的构造函数,同时包含姓名,帐号,存款余额等属性,并且要求实现构造函数的重载。对于该银行客户类,实现属性存款余额的读写操作,实现包含异常处理的验证文本框输入是否有效整型数的功能,创建一个指向SQL SERVER的连接,并将数据库中的数据在DataGrid控件中显示.

/// <summary>
/// 银行客户类
/// </summary>

public class BankCustomer : Customer, IBankCustomer
{
    
public BankCustomer() : base() { }

    
public BankCustomer(int customerId, string customerName, Account accountInfo)
        : 
base()
    
{
        
this._customerId = customerId;
        
this._customerName = customerName;
        
this._accountInfo = accountInfo;
    }
 

    
/// <summary>
    
/// 读取客户及帐户相关信息
    
/// </summary>

    public override void Load()
    
{
        
throw new Exception("The method or operation is not implemented.");
    }


    
/// <summary>
    
/// 新开户
    
/// </summary>

    public override bool Insert()
    
{
        
throw new Exception("The method or operation is not implemented.");
    }


    
/// <summary>
    
/// 更新客户信息
    
/// </summary>

    public override bool Update()
    
{
        
throw new Exception("The method or operation is not implemented.");
    }


    
/// <summary>
    
/// 删除
    
/// </summary>

    public override bool Delete(string customerId)
    
{
        
throw new Exception("The method or operation is not implemented.");
    }


    
IBankCustomer 成员
}


/// <summary>
/// 银行帐户类
/// </summary>

public class Account
{
    
private string _accountNo = string.Empty;
    
private float _balance = 0;

    
public Account()
    
{
        
//在此处添加逻辑
    }


    
public Account(string accountNo, float balance)
    
{
        
this._accountNo = accountNo;
        
this._balance = balance;
    }


    
/// <summary>
    
/// 帐号
    
/// </summary>

    public string AccountNo
    
{
        
get return this._accountNo; }
        
set this._accountNo = value; }
    }


    
/// <summary>
    
/// 余额
    
/// </summary>

    public float Balance
    
{
        
get return this._balance; }
        
set this._balance = value; }
    }

}


/// <summary>
/// 客户类
/// </summary>

public abstract class Customer
{
    
protected string _customerId = string.Empty;
    
protected string _customerName = string.Empty;
    
protected Account _accountInfo = null;

    
public Customer()
    
{
        
//在此处添加代码
    }


    
public string CustomerId
    
{
        
get return this._customerId; }
        
set this._customerId = value; }
    }


    
public string CustomerName
    
{
        
get return this._customerName; }
        
set this._customerName = value; }
    }


    
public Account AccountInfo
    
{
        
get return this._accountInfo; }
        
set this._accountInfo = value; }
    }


    
public abstract bool Insert();

    
public abstract bool Update();

    
public abstract bool Delete(string customerId);

    
public abstract void Load();

}


public interface IBankCustomer
{
    
bool Add(float money);
    
bool Take(float money);
}

 

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值