// Function that computes the interest produced by an amount // invested at a given interest rate for a specified number of days function interest(amount, rate, days) { let interest = amount*rate*days/365; return interest; } // Function that computes the capital accumulated by an amount // invested at a given interest rate for a specified number of days function capital(amount, rate, days) { let capital = amount*(1+rate*days/365); return capital; } // Function that computes the interest produced by an amount // invested at a given interest rate for a specified number of days // and then the capital accumulated by that amount function interestAndCapital(amount, rate, days) { let interest = amount*rate*days/365; let capital = amount*(1+rate*days/365); console.log("The interest produced is " + interest + " and the capital accumulated is " + capital); }
## Fixing Errors Sometimes you will get an error from the interpreter when you try to run your code. When this happens, you need to fix the error before you can run the program. Let's consider a simple example: