文件名称:ex11
介绍说明--下载内容均来自于网络,请自行研究使用
1. 设计一个类SavingsAccount,定义一个静态数据成员记录存款的年利率(rate),该类的每个成员都包含一个私有的数据成员balance,表示该成员当前的存款数额。提供一个成员函数CalMonthlyInterest(),用以计算月利息(用balance乘以rate再除以12),并将这个月利息加入balance中。提供一个静态成员函数ModifyRate(),用以改变静态数据成员rate的值。定义两个不同的SavingsAccount对象saver1和saver2,当前存款数额balance分别为2000.00和3000.00。首先将rate设置为3 ,计算每个存款人的月息并打印新的结果,然后将rate设置为4 ,再次计算每个存款人的月息并打印新的结果。-1. To design a type SavingsAccount, define a static data member of record of deposits interest rate (rate), every member of the class contains a private data member balance, that the members of the current amount of the deposit. Member functions to provide a CalMonthlyInterest (), for the purpose of calculating interest on (with balance multiplied by the rate divided by 12), and this month joined the balance of interest. Provide a static member function ModifyRate (), to change the static data members of the value of rate. SavingsAccount definition of two different objects saver1 and saver2, the current deposit balance amount of 2000.00 and 3000.00, respectively. First rate is set to 3 , calculated for each of the monthly interest of depositors and print new results, and then rate is set to 4 , again calculated for each of the monthly interest of depositors and print new results.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ex11.cpp