


下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、工程三 个人银行账户管理系统、设计要求设计一个个人银行账户管理程序,能够显示帐户信息、存款、取款、余额、结算利息等操作。要求:个人根据实际能力进行设计,可以在根本功能的实现的前提下尽可能充实完善自己的程序。二、设计思想1、类的结构图 < 见右>2?程序主要功能说明: amou nt=floor(amount*100+0.5)/100将计算结果保存到小数点后两位. void record(i nt date,double amoun t):期为止的存款金额按日累计值 in terest=accumulate(date)*rate/365三、源代码获得到指定的日利息计算.#in clu
2、de<iostream>#in clude<cmath>using n amespace std;class Sav in gsAcco unt / private: 储蓄账户类int id; / 账号 double bala nee; / int lastDate; / double rate; /余额 上次变更余额的时期存款的年利率余额按日累加之和double accumulati on; /记录一笔账,date为日期,amount为金额,说明 desc为Savin gsacco unt-id:i nt-shijia n:i nt-shijia n 1:i nt-s
3、hijia n 2:i nt-ri:i nt-float : lilv-zhanghao : int-bala n ce:double-rate:double-lastDate:i nt-accumulati on: double-record:(date : int,amount ; double)-accumulate ( date:int ) :double +getBala n ce():double+getrate():double+show()+deposit(date:int,amount: double)+withdraw(date:i n t,am oun t:double)
4、+settle(date:i nt)void record(i nt date,double amoun t);/获得到指定的日期为止的存款金额按日累计值double accumulate(i nt date) const retur n accumulatio n+bala n ce*(date-lastDate);public: /构造函数Savin gsAcco un t(i nt date,i nt id,double rate);int getId() retur n id;double getBala n ce() retur n bala nee ;double getRate(
5、) return rate;void deposit (i nt date , double amoun t);/存入现金void withdraw (int date, double amoun t);/取出现金/计算利息每年1月1日调用一次函数void settle(i nt date);/显示账户信息void show();/SavingsAccount 类相关成员的实现 SavingsAccount:SavingsAccount (int date,int id, double rate): id(id),balance(0),rate(rate),lastDate(date),acc
6、umulation(0) cout<<date<<"t#"<<id<<"is created"<<endl;void SavingsAccount:record(int date,double amount) accumulation=accumulate(date); lastDate=date;amount=floor(amount*100+0.5)/100;/ 保存小数点后两位 balance+=amount; cout<<date<<"t#"&
7、lt;<id<<"t"<<amount<<"t"<<balance<<endl;void SavingsAccount:deposit(int date,double amount) record(date,amount);void SavingsAccount:withdraw(int date,double amount) if (amount>getBalance() cout<<"Error: not enoughmoney"<<e
8、ndl;else record(date,-amount);void SavingsAccount:settle(int date) double interest=accumulate(date)*rate/365; /计算利息 if(interest!=0)record(date,interest);accumulation=0;void SavingsAccount:show() cout<<"#"<<id<<"tBalance: "<<balance;int main()int shijian,sh
9、ijian1,shijian2;int ri,zhanghao;float lilv;int jine,jine1;cout<<"Create a account"<<endl;cout<<"Enter the account cteated date: "cin>>ri;cout<<"Enter account number : "cin>>zhanghao; cout<<"One year of Interest rates : &quo
10、t;/ 年利率cin> >lilv;Savin gsAcco unt sa(ri,zhan ghao,lilv); cout«"E n ter the deposit time cin> >shijia n;cout<<"E n ter deposit amount cin ?ji ne;sa.deposit(shijia n,jin e); cout<<"E nter withdrawals time:"/取款时间cin> >shijia n1;cout<<"E
11、 n ter the amount you want to withdrawals cin ?ji n e1;sa.withdraw(shijia n 1,ji n e1);cout<<"E n ter how long you acco un ted already cin> >shijia n2;sa.settle(shijia n 2);/取款金额:"/开户至今时间sa.show();coutvve n dl;return 0;、士四、测试结nwwtemp.exereate a acco untn ter the acco unt cteated date 1 nteracco unt nu mber:1234 ine year ofInterest rates : 0. 1 312341s created theEdeposit time:deposit amount : ?1234(En ter h10000withdrawals t ime1000010000En ter:100IEnter the amount you want to withdrawalst 9000 51234 100-90001000Enter how long you accounted already : 1
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 第10课 门字框说课稿小学书法湘美版六年级上册-湘美版
- FANUC-PMC课件教学课件
- Family-Tree课件教学课件
- 信息技术知识培训课件
- 4 烛之武退秦师 《左传》说课稿高中语文人教版必修1-人教版
- 信息培训知识点课件
- Excel课件资源教学课件
- 信封课件教学课件
- 本册综合说课稿小学综合实践活动三年级下册鲁科版
- EPS课件教学课件
- 2025少先队基础知识题库(含答案)
- 人教版九年级物理上-各单元综合测试卷含答案共五套
- 癌症病人三阶梯止痛治疗原则标准课件
- 颅脑损伤患者护理查房课件
- 重要环境污染物及环境疾病课件
- 《嵌入式技术应用》课程标准
- 部编本语文五年级上册第一单元教材解读
- 医院放疗科护理记录(模板)
- 含硫化氢油气井井下作业推荐作法
- 中国医院质量安全管理 第4-6部分:医疗管理 医疗安全(不良)事件管理 T∕CHAS 10-4-6-2018
- 含分布式电源的配电网潮流计算毕业设计说明
评论
0/150
提交评论