id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

getNumberOfYears


There is a bank account that earns 5 percent interest per year. The initial account balance is $10000. Given a target balance (for example, $20000), return the number of years that it takes for the account balance to reach the target balance. The number of years should be an integer. (Difficulty level: 2)


getNumberOfYears(12000) → 4
getNumberOfYears(15000) → 9
getNumberOfYears(20000) → 15

...Save, Compile, Run (ctrl-enter)

public int getNumberOfYears(double targetBalance){ }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Copyright Nick Parlante 2017 - privacy