Needs to be written in Java 2.13 (Financial application: calculating the future
ID: 3616128 • Letter: N
Question
Needs to be written in Java2.13 (Financial application: calculating the future investmentvalue) Write a program that reads in investment amount, annualinterest rate, and number of years, and displays the futureinvestment value using the following formula:
futureInvestmentValue =
investmentAmount * (1 +monthlyInterestRate)^numberOfYears*12
For example,if you enter amount 1000, annual interest rate 3.25%,and number of years 1, the future investment value is 1032.98.
Hint: Use the Math.pow(a, b) method to compute araised to the power of b
Explanation / Answer
please rate - thanks import java.util.*; public class untitled{ public static void main(String []args) {double invest,rate,future; int years; Scanner in=new Scanner(System.in); System.out.print("Enter investment: "); invest=in.nextDouble(); System.out.print("Enter interest rate: "); rate=in.nextDouble(); System.out.print("Enter number of years: "); years=in.nextInt(); future=invest*Math.pow((1+rate/1200.),years*12); System.out.println("investment: $"+invest); System.out.println("yearlyrate: "+rate+"%"); System.out.printf("future value after "+years+" years:$%.2f ",future); } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.