请假一下,这道题怎么做啊
											使用抽象类,实现银行账户的概念,包括的字段有“账号”、“储户姓名”、“存款余额”,包括的方法有“存款”、“取款”、“查询”、“计算存款的利息”。实现银行定期存款账户、银行活期存款账户。要求:输出这两个账户的信息(帐号,储户姓名,存款余额,存款的利息)   附:   活期是0.5%   定期:三个月2.85%半年3.05%一年3.25%二年4.15%三年4.75%五年5.25%用C++写
 程序代码:
程序代码:#include <windows.h>
#include <iostream>
using namespace std;
const LPSTR Msg = "系统提示信息...";
CHAR buffer[20];
class Account
{
public:
    VOID SaveMoney(UINT money);//存款
    BOOL DrawMoney(UINT money);//取款
    virtual VOID Query();//查询
    virtual DOUBLE Interest() = 0;//计算存款利息
protected:
    LPSTR m_ID;//账号
    LPSTR m_Name;//姓名
    UINT m_ReSum;//余额
};
VOID Account::SaveMoney(UINT money)
{
    m_ReSum += money;
    ZeroMemory(buffer, sizeof(CHAR)*20);
    wsprintf(buffer, "存款成功! 存款金额为: %u", money);
    MessageBox(NULL, buffer, Msg, MB_OK);
}
BOOL Account::DrawMoney(UINT money)
{
    ZeroMemory(buffer, sizeof(CHAR)*20);
    if (money > m_ReSum)
    {
        MessageBox(NULL, "余额不足", Msg, MB_OK);
        return FALSE;
    }
    m_ReSum -= money;
    wsprintf(buffer, "取款成功! 取款金额为: %u", money);
    MessageBox(NULL, buffer, Msg, MB_OK);
    return TRUE;
}
VOID Account::Query()
{
    cout << "\t账号: " << m_ID << endl;
    cout << "\t姓名: " << m_Name << endl;
    cout << "\t余额: " << m_ReSum << endl;
}
class FixAccount:public Account
{
public:
    FixAccount(LPSTR id, LPSTR name, UINT money, UINT months);
    ~FixAccount();
    VOID Query();//查询
    DOUBLE Interest();//计算存款利息
protected:
    UINT m_Month;
};
FixAccount::FixAccount(LPSTR id, LPSTR name, UINT money, UINT months)
{
    HANDLE heap = GetProcessHeap();
    m_ID = (LPSTR) HeapAlloc (heap, HEAP_ZERO_MEMORY, lstrlen(id)+1);
    CopyMemory(m_ID, id, lstrlen(id));
    m_Name = (LPSTR) HeapAlloc (heap, HEAP_ZERO_MEMORY, lstrlen(name)+1);
    CopyMemory(m_Name, name, lstrlen(name));
    m_ReSum = money;
    m_Month = months;
}
FixAccount::~FixAccount()
{
    HANDLE heap = GetProcessHeap();
    HeapFree( heap, HEAP_NO_SERIALIZE, m_ID);
    m_ID = NULL;
    HeapFree( heap, HEAP_NO_SERIALIZE, m_Name);
    m_Name = NULL;
}
VOID FixAccount::Query()
{
    Account::Query();
    cout << "\t时间: " << m_Month << endl;
    cout << "\t利息: " << Interest() << endl;
}
DOUBLE FixAccount::Interest()
{
    if (m_Month >= 60)
    {
        return 0.0525;
    }
    else if (m_Month >= 36)
    {
        return 0.0475;
    }
    else if (m_Month >= 24)
    {
        return 0.0415;
    }
    else if (m_Month >= 12)
    {
        return 0.0325;
    }
    else if (m_Month >= 6)
    {
        return 0.0305;
    }
    else if (m_Month >= 3)
    {
        return 0.0285;
    }
    else
    {
        return 0;
    }
}
class CurrAccount:public Account
{
public:
    CurrAccount(LPSTR id, LPSTR name, UINT money);
    ~CurrAccount();
    VOID Query();//查询
    DOUBLE Interest();//计算存款利息
};
CurrAccount::CurrAccount(LPSTR id, LPSTR name, UINT money)
{
    HANDLE heap = GetProcessHeap();
    m_ID = (LPSTR) HeapAlloc (heap, HEAP_ZERO_MEMORY, lstrlen(id)+1);
    CopyMemory(m_ID, id, lstrlen(id));
    m_Name = (LPSTR) HeapAlloc (heap, HEAP_ZERO_MEMORY, lstrlen(name)+1);
    CopyMemory(m_Name, name, lstrlen(name));
    m_ReSum = money;
}
CurrAccount::~CurrAccount()
{
    HANDLE heap = GetProcessHeap();
    HeapFree( heap, HEAP_NO_SERIALIZE, m_ID);
    m_ID = NULL;
    HeapFree( heap, HEAP_NO_SERIALIZE, m_Name);
    m_Name = NULL;
}
VOID CurrAccount::Query()
{
    Account::Query();
    cout << "\t利息: " << Interest() << endl;
}
DOUBLE CurrAccount::Interest()
{
    return 0.005;
}
VOID Factory(Account *account)
{
    account->Query();
//    account->SaveMoney(1);
//    account->DrawMoney(1);
    cout << endl;
}
INT main(VOID)
{
//    FixAccount *fix=NULL;
//    CurrAccount *cur=NULL;
    Factory(new FixAccount("54321", "红色的吉他", 1000, 64));
    Factory(new CurrAccount("9958", "蓝色的外套", 1110));
    return 0;
}										
					
	 程序代码:
程序代码:/*Author laigaoat2005    Debug cfree 5.0 date:2011 5 29
******************************************************
** 呵呵,没有挣到分,倒让我好好复习了继承
******************************************************
//*/
#include <string>
#include <iostream>
using namespace std;
//使用抽象类实现银行账户的概念,包括字段有 账号 储户姓名 存款余额
//包括的方法有 存款 取款 查询 计算存款的利息
//实现银行定期存款账户、银行活期存款账户。
//要求:输出这两个账户的信息(帐号,储户姓名,存款余额,存款的利息)  
//附:活期是0.5%   定期:三个月2.85% 半年3.05% 一年3.25% 二年4.15% 三年4.75% 五年5.25% 用C++写
class account;
class account_ding;
class account_huo;
ostream& operator<<(account_huo&,ios os);
ostream& operator<<(account_ding&,ios os);
class account{
public:
    void deposit(float);//存款
    void draw(float);//取款
    float query();//查询余额
    virtual float evaluate(int){}; //计算利息    
protected:
    account(int, string&, float,int);
    int _number; //帐号 (只是示范,用float.实际帐号数位很长且不能重复,float是不行的。 )
    string _name;  //姓名
    float _balance; //余额
    int _month;  //
    float _interest; //利息
   
    float _rate;  //利率    
private:
    account(); //禁止空名帐户
};
account::account(int _num, string& _nam, float _bal,int _mon)
        :_number(_num),_name(_nam),_balance(_bal),_month(_mon),_rate(0.005){}
void account::deposit(float _money)
{
    _balance += _money;
}
void account::draw(float _money)
{
    _balance -= _money;
}
float account::query()
{
    return _balance;
}
class account_huo:public account
{
friend ostream& operator<<(ostream& os, account_huo&);
public:
    account_huo( int, string&, float) ;
    virtual float evaluate(float);
};
account_huo::account_huo( int _num, string& _nam, float _bal):account(_num,_nam,_bal,0){}
float account_huo::evaluate(float mon)
{
    return _balance*_rate*mon;  //最好弄个成员存起来。也不知道算利息是不是这么算的,汗! 
}
class account_ding:public account{
friend ostream& operator<<(ostream& os, account_ding&);
public:
    account_ding(int, string&, float,int);
    virtual float evaluate(int);   
};
account_ding::account_ding( int _num, string& _nam, float _bal,int _mon):account(_num,_nam,_bal,_mon){}
float account_ding::evaluate(int mon)
{
    switch(mon)
    {
        case 3:
            _rate=0.0285;
            break;
        case 6:
            _rate=0.0305;
            break;
        case 12:
            _rate=0.0325;
            break;
        case 24:
            _rate=0.0415;
            break;
        case 36:
            _rate=0.0475;
            break;
        case 60:
            _rate=0.0525;
            break;
        default:
            printf("参数有错!\n");
            return 0;
    }
    return _balance*_rate*mon;
}
ostream& operator<<(ostream& os, account_ding& acc)
{   
    os << "帐号: " << acc._number   << endl
       << "姓名: " << acc._name       << endl
       << "余额: " << acc._balance   << endl
       << "时期: " << acc._month       <<  "个月        (说明:0为活期(也可以加个if直接写活期))" <<endl
       << "利率: " << acc._interest     << endl
       << "利息: " << acc._rate         << endl  <<  endl  ;
       //*/
    return     os;
}
ostream& operator<<(ostream& os, account_huo& acc)
{   
    os << "帐号: " << acc._number  << endl
       << "姓名: " << acc._name        << endl
       << "余额: " << acc._balance   << endl
       << "时期: " << acc._month       << "个月         (说明:0为活期(也可以加个if直接写活期))" <<endl
       << "利率: " << acc._interest      << endl
       << "利息: " << acc._rate         << endl  <<  endl  ;
       //*/
    return     os;
}
int main()
{
    string A("客户姓名A");
    string B("客户姓名B");
        //参数有: int _num, string& _nam, float _bal,int _mon
    //account_huo( int, string&, float) ;
    account_huo user_A(56,A,888);
    account_ding user_b(57,B,999,24);
    cout << user_A << user_b;
    return 0;
}