Java编程帮助2 [英] Java programming help 2

查看:48
本文介绍了Java编程帮助2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

抽象超类Funds应该具有2种方法-set和get方法来存储principalAmount.

子类担保需要两种方法-一种set和get方法来计算所赚取的利息.使用以下公式:PrincipleAmount * rate * years(rate和years是传递给该方法的参数).

子类CompoundInterest需要两种方法-set和get方法以计算compoundInterest.使用以下公式:PrincipleAmount * Math.pow((1 + rate),years).同样,rate和years是传递给该方法的参数.

子类Loan需要两种方法-set和get方法来计算totalLoanAmount.请使用以下公式:(principleAmount * Rate * Years)+ principalAmount.同样,rate和years是传递给该方法的参数.

在主要方法中,您应该要求用户提供三项信息-输入本金,金额和年限.在超类基金方法中设置本金,并使用费率和年份作为其他方法的参数.完成3个子类的计算后,显示结果.以下是示例结果:

输入原理量:1000
输入率:0.05
年数:5

以1000.00的本金金额,0.05的利率和5年的时间,您将获得250.00

以1000.00的本金金额,0.05的利率和5年的利率,您将拥有1276.28的复利

以1000.00的本金金额,0.05的利率和5年的利率,您将总共需要偿还1250.00的贷款.

The abstract superclass Funds should have 2 methods - a set and get method to store the principleAmount.

Two methods are needed for sub class Guarantee- a set and get method to calculate the interest earned. Use the formula: principleAmount * rate * years (rate and years are arguments passed to the method).

Two methods are needed for sub class CompoundInterest - a set and get method to calculate the compoundInterest. Use the formula: principleAmount * Math.pow((1 + rate),years). Again, rate and years are arguments passed to the method.

Two methods are needed for sub class Loan - a set and get method to calculate the totalLoanAmount. Use the formula: (principleAmount * Rate * Years) + principleAmount. Again, rate and years are arguments passed to the method.

In the main method, you should ask the user for three pieces of information - enter the principle amount, rate, and years. Set the principle amount in the superclass Funds method, and use the rate and years as parameters to the other methods. Once you do the calculations for the 3 sub classes, display your result. Here is a sample result:

Input principle amount: 1000
Input rate: 0.05
Number of years: 5

With a principle amount of 1000.00 , an interest rate of 0.05, and 5 years, you would have earned 250.00

With a principle amount of 1000.00 , an interest rate of 0.05, and 5 years, you would have compound interest of 1276.28

With a principle amount of 1000.00 , an interest rate of 0.05, and 5 years, you would have a total loan payment of 1250.00

推荐答案

阅读
Read the posting guidelines[^] - no-one is going to do your work for you.


在这里不能这样工作.抱歉,这里没有快速提问.这听起来像是您的大学项目/作业,您应该付出一些努力.

我们希望您花一些时间来尝试解决您面临的问题,然后再花一些时间在此处发布问题时提出问题.

这是询问者的期望:
1. 先尝试您要做什么!
2.制定看起来像问题/无法解决的问题.

试试看,告诉他们是否遇到问题.
成员将非常乐于提供这样的帮助.
It does not work like this here. I am sorry but there is no quick question here. This sounds like your college project/assignment, you should put some effort.

We expect you to put some time in trying the issue that you are facing and then some time in formulating the question while posting here.

Here is what is expected by enquirers:
1. TRY first what you want to do!
2. Formulate what was done by you that looks like an issue/not working.

Try them and tell if you face issues.
Members will be more than happy to help like this.


Google再次失败了吗?该死的,一个不能依靠那些新经济"公司!

如果您的聪明程度只有您想像的一半,那么您会找到答案的.
但是请记住-您的老师也知道这些网站,并且可以查看您是否亲自编写了这些内容.
Is Google down again? damn, one cannot depend on those "New Economy" companies!

If you where just half as smart as you think you are you''d find the answer.
But remember - your teacher knows those sites too and is able to see if you''ve written it yourself.


这篇关于Java编程帮助2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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