需要帮助java编码的公式 [英] Need help for java coding of a formula

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

问题描述

我只需要一些帮助就以下公式制作一个java程序。

let

p =当前校长

ad =年度加法

r =利率

t =年数

c =每年复合的次数

il be接受用户输入但是例如

让p = 100

r = 10%= 10/100 = 0.1

ad = 100

t = 3

c = 1

所以第一年;

ans = p + ad *(1 + r / c) ^ c

ans = 200 * 1.1 = 220

所以p为第2年= 220

第二年

ans = p + ad *(1 + r / c)^ c

ans = 320 * 1.1 = 352

for 3rd p = 352

然后是第三年

ans = 452 * 1.1

= 497.2将其显示为输出



我尝试了什么:



我不知道如何循环这个,所以如果有人可以帮助它将是一个很大的帮助

i just need some help to make a java program on the following formula.
let
p=current principal
ad=annual addition
r=rate of interest
t=no of years
c=number of times to be compounded yearly
il be taking user input but for eg
let p=100
r=10%=10/100=0.1
ad=100
t=3
c=1
so for first year;
ans=p+ad*(1+r/c)^c
ans=200*1.1=220
so p for 2nd year =220
for second year
ans=p+ad*(1+r/c)^c
ans=320*1.1=352
for 3rd p=352
then for third year
ans=452*1.1
=497.2 which shld be showed as output

What I have tried:

im nt understanding how to loop this,so if someone could help it would be a great help

推荐答案

看起来像作业。你到目前为止尝试了什么?



你不能在这里提出这样的问题。你需要先付出一些努力,自己尝试一下,然后如果发现任何困难,请将其作为一个问题发布。但是不要像这样张贴你的整个作业。



这是你的作业,你有责任完成它。我们不是来为你做功课。请阅读代码项目快速解答常见问题解答 [ ^ ]在此处发布问题之前。不要以这种方式破坏论坛。



亲自尝试,你可能会发现它并不像你想象的那么难!





KR
Looks like a homework. What have you tried so far?

You cannot ask such questions here. You need to put some efforts in it first, try something on your own and then if you find any difficulty, post it as a question. But don't post your entire homework like this.

It's your homework, it's your responsibility to complete it. We are not here to do the homework for you. Please read Code Project Quick Answers FAQ[^] before posting question here. Don't ruin the forum this way.

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


KR


引用:

ans = p + ad *(1 + r / c)^ c

ans=p+ad*(1+r/c)^c




引用:

ans = 200 * 1.1 = 220

ans=200*1.1=220



上述公式之间存在不匹配:其中一个不正确。











循环实现起来非常简单。例如,请参阅:循环 - 学习Java - 免费交互式Java教程 [ ^ ]。


您的问题中已有公式。如果你做一些阅读,把它变成Java代码并不困难。请参阅 Java™教程 [ ^ ]。
You already have the formula in your question. Turning that into Java code is not difficult if you do some reading. See The Java™ Tutorials[^].


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

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