Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assignment J Credit Card Payoff Calculator Key prugramming concepts: toriables,

ID: 3877399 • Letter: A

Question



Assignment J Credit Card Payoff Calculator Key prugramming concepts: toriables, sopud, printf, basie math Approzimate lines of ode: 18 does not incade commeuts, yhite space, or an of Conmands pos ceu't nse: N/A Program Inputs Balanced Owed: User wall aheous enter a positive naweric valae -User will ahvays euter a posntise namersc elue -User will alweys ester a positive iameric mive . APR Interest Rate (%): . Expectod Monthly Payment: Program Outputs Repayment Table Option Payment Months Payott - Croute a table that shous the total money sended to psyoll the credit eard for sunou options Replace each XXX with the sppropriste lse. Use eraetly 2 decimal places for al money solue also months suould be rouuded to the nest highest ahole month. Assignment Details Your task is to recreate a popular online credit card pague calculstor! Given sotie initial informstion from the user, determine how qaickly the user can repay his/ber debt. Here is the app to base your code around Debe Repayment Caewsto Figure I: httpe://www.crsditkarma.com/calculators/debtrepayment-to

Explanation / Answer

Answer)

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Title of the document</title>

<script>

function getAdjustedRate(rate){//returns adjustedRate

var days=365;

var power=30.4167;

return (Math.pow(1+rate/(100*days),power)-1);

}

function getMonths(adjustedRate,bal,monthlyInstallment){//returns number of months to pay for fixed monthly installement

return Math.ceil(-Math.log(1-(adjustedRate*bal)/monthlyInstallment)/Math.log(1+adjustedRate));

}

function getPayment(adjustedRate,bal,month){//returns payment for given months adjustedRate and months

return ((adjustedRate*bal)/(1-Math.pow(1+adjustedRate,-month)));

}

function func(){//called on invoking submit button

var bal=document.getElementById("bal").value;//get balance from html

var rate=document.getElementById("rate").value;//get rate from html

var monthlyInstallment=document.getElementById("mi").value;//get monthly installment from html

var adjustedRate=getAdjustedRate(rate);

var months=getMonths(adjustedRate,bal,monthlyInstallment);

var payoff=monthlyInstallment*months;//calculate payoff

document.getElementById("p1").innerHTML=monthlyInstallment;//display monthly installment for option 1)

document.getElementById("m1").innerHTML=months;//display months for option 1)

document.getElementById("pay1").innerHTML=(payoff.toFixed(2));//display payoff for option 1)

monthlyInstallment*=2;

document.getElementById("p2").innerHTML=monthlyInstallment;//display monthly installment for option 2)

months=getMonths(adjustedRate,bal,monthlyInstallment);

document.getElementById("m2").innerHTML=months;//display months for option 2)

document.getElementById("pay2").innerHTML=((monthlyInstallment*months).toFixed(2));

//display payoff for option 2)

months=3;

var monthlyInstallment=getPayment(adjustedRate,bal,months);

document.getElementById("p3").innerHTML=monthlyInstallment;//display monthly installment for option 3)

document.getElementById("m3").innerHTML=months;//display months for option 3)

document.getElementById("pay3").innerHTML=((monthlyInstallment*months).toFixed(2));

//display payoff for option 3)

document.getElementById("result").style.display='block';//show result table

document.getElementById("input").style.display='none';//hide input table

}

</script>

</head>

<body>

<table cellpadding="4" id="input"><!-- table to get input-->

<tr><td>

Balanced Owed:</td>

<td><input type="number" id="bal"></input></td>

</tr>

<tr>

<td>Interest Rate:</td>

<td><input type="number" id="rate"></input></td>

</tr>

<tr>

<td>Monthly Installment:</td>

<td><input type="number" id="mi"></input></td>

<tr>

<td colspan="2"><input type="button" value="submit"></td>

</table>

<table id="result" cellpadding="4"><!-- table to show ouput-->

<thead>

<th>Otption</th>

<th>Payment</th>

<th>Months</th>

<th>Payoffs</th>

</thead>

<tbody>

<tr>

<td>1)</td>

<td id="p1"></td>

<td id="m1"></td>

<td id="pay1"></td>

</tr>

<tr>

<td>2)</td>

<td id="p2"></td>

<td id="m2"></td>

<td id="pay2"></td>

</tr>

<tr>

<td>3)</td>

<td id="p3"></td>

<td id="m3"></td>

<td id="pay3"></td>

</tr>

<tr>

</tr>

</tbody>

</table>

</body>

</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote