储蓄账户类别 [英] Savings account class

查看:65
本文介绍了储蓄账户类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

创建类CSavingsAccount.

使用Shared类变量为所有帐户所有者存储mAnnualInterestRate.
该类的每个对象都包含一个Private实例变量mSavingsBalance,该变量指示保护程序当前所存入的金额.提供方法CalculateMonthlyInterest,将mSavingsBalance乘以AnnualInterestRate除以12,即可计算出每月利息;此兴趣应添加到mSavingsBalance中.

提供一个共享方法ModifyInterestRate,该方法将mAnnualInterestRate设置为新值.编写一个程序来测试类CSavingsAccount.实例化两个CSavingsAccount对象,saver1和saver2,余额分别为$ 2000.00和$ 3000.00.

将CAnnualInterestRate设置为4%,然后计算每月利息并打印每个储蓄者的新余额.然后将mAnnualInterestRate设置为5%,计算下个月的利息,并为每个储户打印新余额.

编写一个程序,说明具有自己的Try块的方法不必捕获Try块中发生的所有可能的异常.某些例外可以进入其他范围并在其他范围内进行处理.

Create class CSavingsAccount.

Use a Shared class variable to store the mAnnualInterestRate for all account holders.
Each object of the class contains a Private instance variable mSavingsBalance indicating the amount the saver currently has on deposit. Provide method CalculateMonthlyInterest to calculate the monthly interest by multiplying the mSavingsBalance by AnnualInterestRate divided by 12; this interest should be added to mSavingsBalance.

Provide a Shared method ModifyInterestRate that sets the mAnnualInterestRate to a new value. Write a program to test class CSavingsAccount. Instantiate two CSavingsAccount objects, saver1 and saver2, with balances of $2000.00 and $3000.00, respectively.

Set CAnnualInterestRate to 4%, then calculate the monthly interest and print the new balances for each of the savers. Then set the mAnnualInterestRate to 5% and calculate the next month’s interest and print the new balances for each of the savers.

Write a program demonstrating that a method with its own Try block does not have to Catch every possible exception that occurs within the Try block. Some exceptions can slip through to, and be handled in, other scopes.

推荐答案

2000.00和


3000.00.

将CAnnualInterestRate设置为4%,然后计算每月利息并打印每个储蓄者的新余额.然后将mAnnualInterestRate设置为5%,计算下个月的利息,并为每个储户打印新余额.

编写一个程序,说明具有自己的Try块的方法不必捕获Try块中发生的所有可能的异常.某些例外情况可能会进入其他范围并在其他范围内进行处理.
3000.00, respectively.

Set CAnnualInterestRate to 4%, then calculate the monthly interest and print the new balances for each of the savers. Then set the mAnnualInterestRate to 5% and calculate the next month’s interest and print the new balances for each of the savers.

Write a program demonstrating that a method with its own Try block does not have to Catch every possible exception that occurs within the Try block. Some exceptions can slip through to, and be handled in, other scopes.


我们不做您的作业:这是有原因的.在这里,您可以考虑自己被告知的内容,并尝试理解它.也可以在那里帮助您的导师识别您的弱点,并将更多的注意力放在补救措施上.

自己尝试,您可能会发现它并不像您想的那么困难!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!


这篇关于储蓄账户类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆