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 – 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
Expert's answer
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 – 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("enterP (example: 100 or 100,1)"); doubleP=in.nextDouble();
//acceptsR System.out.println("enterR (example: 1 or 0,1)"); doubleR=in.nextDouble();
Comments
Leave a comment