using pseudocode for this program is: input the investment amount input the annu
ID: 3887742 • Letter: U
Question
using pseudocode for this program is:
input the investment amount
input the annual interest rate
input the number of years
concert annual interest rate to decimal value
compute the monthly interest rate
compute the total number of months of the investment
compute future investment value
output the future investment value
Explanation / Answer
package com.demo;
import java.util.Scanner;
public class ElementaryProgramming {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("enter investment amount");
double investmentAmount = scanner.nextDouble();
System.out.println("enter annual interest rate ");
double annualInterestRate = scanner.nextDouble();
double monthlyInterestRate = annualInterestRate / 12;
System.out.println(monthlyInterestRate);
double roundoff = Math.round(monthlyInterestRate * 100.0) / 100.0;
System.out.println(roundoff);
System.out.println("enter no of years");
int noofyears = scanner.nextInt();
int noofmonths = noofyears * 12;
System.out.println(noofmonths);
double value = Math.pow(1 + roundoff, noofmonths);
double roundoff1 = Math.round(value * 100.0) / 100.0;
System.out.println("roundoff" + roundoff1);
double futureInvestmentValue = investmentAmount * roundoff1;
System.out.println("future" + futureInvestmentValue);
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.