Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void No50 () {
- final double initialCapital = 223.12;
- final double interestRate = 1.5;
- final int years = 3; //change years
- double capital = initialCapital; //init capital and sets value
- System.out.println("Initial capital:" + initialCapital);
- System.out.println("Annual interest rate:" + interestRate);
- for(int i = 0; i < years; i++) { //loop through all years
- capital *= (1 + interestRate/100); //multiple Rate to capital
- }
- System.out.println("Capital after " + years + " years:" + capital); //Print Rate
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement