# Answer to Question #19985 in Java | JSP | JSF for shalenee

Question #19985
7. If you invest the amount of P at R% interest rate annually. In N years, your investment will be P[1-(R/100)N+1] / (1 &ndash; R/100). Accepts the input of P, R and N and compute the amount of money earned after N years using computer currency format. (Note: Math.pow(A,B) - A raise to the power of B)
1
2012-12-05T09:41:43-0500
import java.util.Scanner;

public class main
{

/**
* Ifyou invest the amount of P at R% interest rate annually.
* In Nyears, your investment will be P[1-(R/100)N+1] / (1 &ndash; R/100).
* Accepts the input of P, R and N and compute the amount of money earnedafter N years using computer currency format.
* (Note: Math.pow(A,B) - A raise to the power of B)
*
*/
publicstatic void main(String[] args)
{
Scannerin=new Scanner(System.in);

//acceptsP
System.out.println(&quot;enterP (example: 100 or 100,1)&quot;);
doubleP=in.nextDouble();

//acceptsR
System.out.println(&quot;enterR (example: 1 or 0,1)&quot;);
doubleR=in.nextDouble();

//acceptsN
System.out.println(&quot;enterN&quot;);
intN=in.nextInt();

doubleamount=(P*(1-(R/100)*N+1))/(1-R/100);// P[1-(R/100)N+1] / (1 &ndash; R/100)

System.out.println(amount);
}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!