Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ch6ex3;
- public class Ch6Ex3
- {
- public static void main(String[] args)
- {
- final int max=5000;
- int inv=2500;
- double interest=0.075;
- double total=inv;
- total+=(total*interest);
- int years=1;
- while(total<max)
- {
- total+=(total*interest);
- years++;
- }
- System.out.println("Years: "+years);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement