question archive Write a program that reads in an investment amount, the annual interest rate, and the number of years, and displays the future investment value using the following formula: futureInvestmentValue = investmentAmount * (1 + monthlyInterestRate)numberOfMonths For example, if you enter the amount 1000, an annual interest rate of 4
Subject:Computer SciencePrice:4.89 Bought3
Write a program that reads in an investment amount, the annual interest rate, and the number of years, and displays the future investment value using the following formula:
futureInvestmentValue = investmentAmount * (1 + monthlyInterestRate)numberOfMonths
For example, if you enter the amount 1000, an annual interest rate of 4.25%, and the number of years as 1, the future investment value is 1043.33. Here is a sample run:
Enter investment amount: 1000
Enter annual interest rate: 4.25
Enter number of years: 1
Accumulated value is 1043.33
import java.util.Scanner;
public class InvestmentRate {
public static void main(String[] args) {
int investmentamount;
float annualinterestrate;
int years;
float accvalue;
Scanner input = new Scanner(System.in);
System.out.println("Enter investment amount: ");
investmentamount = input.nextInt();
System.out.println("Enter annual interest: ");
annualinterestrate = input.nextFloat();
System.out.println("Enter number of years: ");
years = input.nextInt();
accvalue = investmentamount * (1 + (annualinterestrate/12)) * (years*12);
System.out.println(accvalue);
}
}