6
I’m trying to make a accrual of compound interest and I have this code that follows until the moment.
public class ExDesafio_Aula1 {
public static void main(String[]args){
double investimento = 5000.00;
double juros = 0.01;
double valorFinal = investimento * (1 + juros) * 12;
System.out.println(valorFinal);
}
}
The problem is that at the end of the account, it should raise the value between parentheses by 12, not multiply it.
How to solve this problem?
I recently made a calculation where my variables were all integers (result = Math.Pow (base, exponent)), and when compiling I was returned a type incompatibility error, because the result variable was declared as integer. I solved it by declaring it a double. My variable that will receive the result of a calculation done with Math.Pow always has to be double ? Even if the result is integer ?
– water
@Snickers See this other answer: https://answall.com/a/304447/132
– Victor Stafusa