জাভা প্রোগ্রামিং পর্ব-১১



2.13* (Financial application: calculating the future investment value) Write a program that reads in investment amount, annual interest rate, and number of years, and displays the future investment value using the following formula:
futureInvestmentValue =
investmentAmount x (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 a raised to the power of b.

Code : File name-FutureInvestment.java
import java.util.*;
import javax.swing.*;
public class FutureInvestment {
    public static void main (String arg[]){
        Scanner input =new Scanner(System.in);
        System.out.print("Enter investment amount: = ");
        double investmentAmount =input.nextDouble();
        System.out.print("Enter annual interest rate: = ");
        double annualInterestRate =input.nextDouble();
        System.out.print("Enter number of year: = ");
        double numberOfYear =input.nextDouble();
        double monthlyInterestRate = annualInterestRate/1200;
        double futureInvesment =(investmentAmount*(Math.pow(1+monthlyInterestRate, numberOfYear*12)));
        System.out.print("Future investment: = "+futureInvesment);
        }
    }

Loading
Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Flying Twitter Bird Widget By ICT Sparkle