如何在Java中实现特定的数学公式?
我的下一个工作是用这个公式算出每月的付款额 M=p[i(1+i)^n]/[(1+i)^n-1] 在哪里 M=每月抵押贷款付款如何在Java中实现特定的数学公式?,java,Java,我的下一个工作是用这个公式算出每月的付款额 M=p[i(1+i)^n]/[(1+i)^n-1] 在哪里 M=每月抵押贷款付款 P=借款金额(贷款金额) i=月利率(Mintrate) n=付款数量 我尝试了以下方法,但就是想不出来 monp=Loanamount[Mintrate(1+Mintrate)^n]/[(1+Mintrate)^n-1]数学。pow是您需要的,而不是^。您也不能使用[或]。必须使用括号(和)。 有关更多数学函数,请访问: 数学。pow是您需要的,而不是^。您也不能使用[
P=借款金额(贷款金额)
i=月利率(Mintrate)
n=付款数量 我尝试了以下方法,但就是想不出来
monp=Loanamount[Mintrate(1+Mintrate)^n]/[(1+Mintrate)^n-1]代码>数学。pow
是您需要的,而不是^
。您也不能使用[
或]
。必须使用括号(
和)
。
有关更多数学函数,请访问:
数学。pow
是您需要的,而不是^
。您也不能使用[
或]
。必须使用括号(
和)
。
有关更多数学函数,请访问:
数学。pow
是您需要的,而不是^
。您也不能使用[
或]
。必须使用括号(
和)
。
有关更多数学函数,请访问:
数学。pow
是您需要的,而不是^
。您也不能使用[
或]
。必须使用括号(
和)
。
有关更多数学函数,请访问:
您需要在此处使用Math.pow
effectivley
尝试在代码中使用以下命令
package methods;
import java.util.Scanner;
/**
*
* @author Billy
*/
public class Methods {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
double Loanamount; // Loan amount from user
double Aintrate; // User's annual interest rate
double months; // Number of months on loan
double monp; // Monthly payment
double Mintrate; // Monthly interest rate
double n; // The number of payments
// declare an instance of Scanner to read the datastream from the keyboard.
Scanner kb = new Scanner(System.in);
// Get user's loan amount
System.out.print("Please enter your total loan amount: ");
Loanamount = kb.nextDouble();
// Get user's interest rate
System.out.print("Please enter your annual interest rate as a decimal: ");
Aintrate = kb.nextDouble();
// Get user's number of months
System.out.print("Please enter the number of months left on your loan: ");
months = kb.nextDouble();
// Calculate montly interest rate
Mintrate = ((Aintrate / 12));
System.out.println("Your monthly interest rate is " + " " + Mintrate);
// Calculate number of payments
n = ((months * 12));
// Calculate monthly payment
您需要在此处使用Math.pow
effectivley
尝试在代码中使用以下命令
package methods;
import java.util.Scanner;
/**
*
* @author Billy
*/
public class Methods {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
double Loanamount; // Loan amount from user
double Aintrate; // User's annual interest rate
double months; // Number of months on loan
double monp; // Monthly payment
double Mintrate; // Monthly interest rate
double n; // The number of payments
// declare an instance of Scanner to read the datastream from the keyboard.
Scanner kb = new Scanner(System.in);
// Get user's loan amount
System.out.print("Please enter your total loan amount: ");
Loanamount = kb.nextDouble();
// Get user's interest rate
System.out.print("Please enter your annual interest rate as a decimal: ");
Aintrate = kb.nextDouble();
// Get user's number of months
System.out.print("Please enter the number of months left on your loan: ");
months = kb.nextDouble();
// Calculate montly interest rate
Mintrate = ((Aintrate / 12));
System.out.println("Your monthly interest rate is " + " " + Mintrate);
// Calculate number of payments
n = ((months * 12));
// Calculate monthly payment
您需要在此处使用Math.pow
effectivley
尝试在代码中使用以下命令
package methods;
import java.util.Scanner;
/**
*
* @author Billy
*/
public class Methods {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
double Loanamount; // Loan amount from user
double Aintrate; // User's annual interest rate
double months; // Number of months on loan
double monp; // Monthly payment
double Mintrate; // Monthly interest rate
double n; // The number of payments
// declare an instance of Scanner to read the datastream from the keyboard.
Scanner kb = new Scanner(System.in);
// Get user's loan amount
System.out.print("Please enter your total loan amount: ");
Loanamount = kb.nextDouble();
// Get user's interest rate
System.out.print("Please enter your annual interest rate as a decimal: ");
Aintrate = kb.nextDouble();
// Get user's number of months
System.out.print("Please enter the number of months left on your loan: ");
months = kb.nextDouble();
// Calculate montly interest rate
Mintrate = ((Aintrate / 12));
System.out.println("Your monthly interest rate is " + " " + Mintrate);
// Calculate number of payments
n = ((months * 12));
// Calculate monthly payment
您需要在此处使用Math.pow
effectivley
尝试在代码中使用以下命令
package methods;
import java.util.Scanner;
/**
*
* @author Billy
*/
public class Methods {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
double Loanamount; // Loan amount from user
double Aintrate; // User's annual interest rate
double months; // Number of months on loan
double monp; // Monthly payment
double Mintrate; // Monthly interest rate
double n; // The number of payments
// declare an instance of Scanner to read the datastream from the keyboard.
Scanner kb = new Scanner(System.in);
// Get user's loan amount
System.out.print("Please enter your total loan amount: ");
Loanamount = kb.nextDouble();
// Get user's interest rate
System.out.print("Please enter your annual interest rate as a decimal: ");
Aintrate = kb.nextDouble();
// Get user's number of months
System.out.print("Please enter the number of months left on your loan: ");
months = kb.nextDouble();
// Calculate montly interest rate
Mintrate = ((Aintrate / 12));
System.out.println("Your monthly interest rate is " + " " + Mintrate);
// Calculate number of payments
n = ((months * 12));
// Calculate monthly payment
^
的方法称为Math.pow(双a,双b)代码>在Java中
其中a
是要提升的次数b
您的公式将看起来像monp=Loanamount Math.pow((Mintrate(1+Mintrate),n))/(Math.pow((1+Mintrate),n-1))代码>
用于^
的方法称为Math.pow(双a,双b)代码>在Java中
其中a
是要提升的次数b
您的公式将看起来像monp=Loanamount Math.pow((Mintrate(1+Mintrate),n))/(Math.pow((1+Mintrate),n-1))代码>
用于^
的方法称为Math.pow(双a,双b)代码>在Java中
其中a
是要提升的次数b
您的公式将看起来像monp=Loanamount Math.pow((Mintrate(1+Mintrate),n))/(Math.pow((1+Mintrate),n-1))代码>
用于^
的方法称为Math.pow(双a,双b)代码>在Java中
其中a
是要提升的次数b
您的公式将看起来像monp=Loanamount Math.pow((Mintrate(1+Mintrate),n))/(Math.pow((1+Mintrate),n-1))代码>
您需要调用Math.pow(double,double)
或者您可以将所需的类导入为..
导入静态java.lang.Math.pow代码>
然后使用pow()函数,您需要调用Math.pow(double,double)
或者您可以将所需的类导入为..
导入静态java.lang.Math.pow代码>
然后使用pow()函数,您需要调用Math.pow(double,double)
或者您可以将所需的类导入为..
导入静态java.lang.Math.pow代码>
然后使用pow()函数,您需要调用Math.pow(double,double)
或者您可以将所需的类导入为..
导入静态java.lang.Math.pow代码>
然后使用pow()函数使用Math.pow
,这是您要寻找的,而不是^
,您的代码示例也应该包含这种形式,否则,如果不产生任何错误,您的代码的其余部分看起来非常无关。如果使用double
类型仍然足以进行估计,由于四舍五入错误,不应在财务计算中使用它。请使用Math.pow
,这是您要查找的内容,而不是^
,并且您的代码示例应包括以下形式:,否则,如果代码的其余部分不产生任何错误,那么代码的其余部分看起来就无关紧要了。如果使用double
类型仍然足以进行估算,则由于舍入错误,不应在财务计算中使用它。使用Math.pow
,这就是您要查找的内容,而不是^
,此外,您的代码示例应包括此形式,否则,如果不产生任何错误,代码的其余部分看起来就不相关。如果使用double
类型仍然足以进行估算,则由于舍入错误,不应在财务计算中使用它。使用Math.pow
,这就是您要寻找的,而不是^
,您的代码示例也应该包含此形式,否则,如果不产生任何错误,您的代码的其余部分看起来非常无关。如果使用double
类型仍然足以进行估算,则由于舍入错误,不应在财务计算中使用它。