Advertisement
KeeganT

Ch6Ex3

Feb 19th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. package ch6ex3;
  2.  
  3. public class Ch6Ex3
  4. {
  5.     public static void main(String[] args)
  6.     {
  7.         final int max=5000;
  8.         int inv=2500;
  9.         double interest=0.075;
  10.         double total=inv;
  11.         total+=(total*interest);
  12.         int years=1;
  13.         while(total<max)
  14.         {
  15.             total+=(total*interest);
  16.             years++;
  17.         }
  18.         System.out.println("Years: "+years);
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement