Answer to Question #314069 in Java | JSP | JSF for jajee

Question #314069

Write a Java method to compute the future investment value at a given interest rate for a specified number of years.

Sample data (Monthly compounded) and Output:

Input the investment amount: 1000

Input the rate of interest: 10

Input number of years: 5 


1
Expert's answer
2022-03-18T15:32:43-0400
import java.util.Scanner;


class App {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		System.out.print("Input the investment amount: ");
		double principal = scan.nextDouble();
		System.out.print("Enter Rate of Interest : ");
		double rate = scan.nextDouble();
		System.out.print("Input number of years: ");
		int time = scan.nextInt();
		double p = (principal * rate * time) / 100;
		System.out.println("Payment: " + p);
	}
}

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS