我构建了一个运行着一个java类的计算器。我遇到了一个障碍。我有完整的计算器内置和编码在Microsoft Word(功能等)。构建一个循环
我需要添加到它,用循环;我离开的地方跑完美。现在我需要继续它,每次我进入它说,“不要把它放在这里”。如果是这样的话,我还有多远?或者我需要在计算器上添加什么?
请指教,如果我问这个权利与否。
下面是一些计算器:
public static void main(String[] args) {
//Declaring and initializing the variables
double principle = 200000.0;
double interestRate = 0.0575;
int term = 360;
DecimalFormat decimalPlaces=new DecimalFormat("0.00");
// Calculating the monthly payment: M = P [ i(1 + i)n ]/[ (1 + i)n - 1]
double monthlyRate = (interestRate/12);
double t = Math.pow((1 + monthlyRate),term);
double payment = (principle * monthlyRate * t)/(t-1);
//Display the results on computer screen
System.out.println("The monthly payment for a mortgage of 200000 is $" +
decimalPlaces.format(payment));
这是我想补充:
#include <iostream>
#include "math.h"
using namespace std;
double calcPayment(double principle, double rate, double term) {
@buddy:显示代码。 – 2011-03-15 23:22:50
“建立在微软的话”与Java ...? – 2011-03-15 23:23:05
不幸的是,你问这个问题的方式很不明确。请记住,您需要假设我们对您的程序设置方式一无所知。请编辑您的问题尽可能清晰和详细,并在适用的情况下包含代码示例。另外,还可以使用正确的标点符号并减少运行的句子。 – StriplingWarrior 2011-03-15 23:24:16