Guest User

Untitled

a guest
Jun 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.49 KB | None | 0 0
  1.         import java.util.Scanner;
  2.          
  3.          
  4.         public class Investment {
  5.                
  6.                 public static void main(String[] args) {
  7.                         //declare variables
  8.                         double money;
  9.                         double interest;
  10.                         int years;
  11.                         Scanner input;
  12.                        
  13.                         //initialise variables
  14.                         money = 0;
  15.                         interest = 0;
  16.                         years = 0;
  17.                         input = new Scanner(System.in);
  18.                        
  19.                         System.out.println("How much are you investing?");
  20.                         money = input.nextDouble();
  21.                        
  22.                         System.out.println("How much is the interest rate?");
  23.                         interest = input.nextDouble();
  24.                        
  25.                         System.out.println("How many years will this mature?");
  26.                         years = input.nextInt();    
  27.                 }
  28.                
  29.                 public static double futureInvestmentValue(
  30.                     double investmentAmount, double monthlyInterestRate, int years) {
  31.                              
  32.                     for(int i=0; i<years; i++) {
  33.                             futureInvestmentValue =
  34.                             investmentAmount x (1 + monthlyInterestRate)numberOfYears*12
  35.  
  36.                            
  37.  
  38.                 }
  39.         }
Add Comment
Please, Sign In to add comment