0

Help...

The program you are given should calculate the annual income of a given loan. The program takes the loan initial amount and the annual interest percentage as input, then creates the loan object. Complete the function outside the constructor to calculate the annual income, then assign that value to the corresponding field, that you also create, of the constructor in order to execute the given output. Sample Input 15000 20 Sample Output 3000 Explanation The output represent the yearly income of the loan with a 15000 initial amount and 20% annual interest : 20/100*15000 = 3000. ---------- function main() { //get the initial amount and the interest percentage var amount = parseInt(readLine(),10); var yearPercent = parseInt(readLine(),10); var loan1 = new Loan(amount, yearPercent); //output to console console.log(loan1.yearIncome()); } function Loan(amount, percent) { this.amount = amount; this.yearPercent = percent; //your code goes he

17th Apr 2021, 10:03 AM
Владимир Мельников
Владимир Мельников - avatar
2 Réponses
+ 3
//Check out function main() { var inp = parseInt(readLine(), 10); var total = 80/100 *inp; console.log(total ) }
17th Apr 2021, 12:11 PM
Aditya
Aditya - avatar
0
Show your attempt please.
17th Apr 2021, 10:08 AM
The future is now thanks to science
The future is now thanks to science - avatar