BankCard.cpp
资源名称:ATM.rar [点击查看]
上传用户:szmwdq
上传日期:2022-07-16
资源大小:528k
文件大小:1k
源码类别:
金融证券系统
开发平台:
Visual C++
- // BankCard.cpp: implementation of the BankCard class.
- //
- //////////////////////////////////////////////////////////////////////
- #include "BankCard.h"
- //////////////////////////////////////////////////////////////////////
- // Construction/Destruction
- //////////////////////////////////////////////////////////////////////
- BankCard::BankCard(string n,int c,float b,string ba)
- {
- num=n; code=c; balance=b; bank=ba;
- }
- void BankCard::display()
- {
- cout<<"普通卡用户"<<endl;
- cout<<"卡号:"<<num<<endl;
- cout<<"帐户余额:"<<balance<<endl;
- cout<<"所属银行:"<<bank<<endl;
- }
- string BankCard::getNum(){return num;}
- void BankCard::setBalance(double b){balance=b;}
- string BankCard::getBank(){return bank;}
- bool BankCard::judgeCode(int cm)
- {
- if(cm==code) return true;
- else return false;
- }
- double BankCard::getBalance(){return balance;}
- void BankCard::deposit(double amount) { balance += amount; } //存款
- void BankCard::withdrawal(double a)
- {
- int m;
- cout<<"请输入密码:";
- cin>>m;
- if(judgeCode(m)) balance-=a;
- else cout<<"密码错误!"<<endl;
- }
- BankCard::~BankCard()
- {
- }