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

JAVASCRIPT ONLY, NOT JAVA!!!!!! Design and implement a program that will allow u

ID: 3823720 • Letter: J

Question

JAVASCRIPT ONLY, NOT JAVA!!!!!!

Design and implement a program that will allow us to determine the length of time needed to pay off a credit card balance, as well as the total interest paid.

The program must implement the following functions:

displayWelcome

This function should display the welcome message to the user explaining what the program does.

calculateMinimumPayment

This function calculates the minimum payment. It should take balance and minimum payment rate as arguments and return the minimum payment.

So the value you display for minimum payment is the value you get from this method. Do not use a literal hardcoded value when you display the minimum payment!

displayPayments

This function displays the actual payment schedule. It should take the balance and monthly interest rate as arguments.

Use the 1500, 18% and 2% literal values below.

See the sample execution below:

This program will determine the time to pay off a credit card and the interest paid based on the current balance,

the interest rate, and the monthly payments made.

Balance on your credit card: 1500

Interest Rate: 18

Assuming a minimum payment of 2% of the balance ($20 min)

Your minimum payment would be $ 30.00

PAYOFF SCHEDULE

_________________

Cont.

Save your program in a file named credit.js and save it in a folder called Assignment_3. Zip that up and rename it to lastName_Assig#_Attempt#.zip ex: corbin_assig2_Attempt1.zip Zip that folder and submit in the dropbox.

Year Balance Payment Number Interest Paid Minimum Payment 1 $ 1,492.50 1 $         22.50 $                      30.00 $ 1,485.04 2 $         44.89 $                      29.85 $ 1,477.61 3 $         67.16 $                      29.70 $ 1,470.22 4 $         89.33 $                      29.55 $ 1,462.87 5 $      111.38 $                      29.40 $ 1,455.56 6 $      133.32 $                      29.26 $ 1,448.28 7 $      155.16 $                      29.11 $ 1,441.04 8 $      176.88 $                      28.97 $ 1,433.83 9 $      198.50 $                      28.82 $ 1,426.67 10 $      220.00 $                      28.68 $ 1,419.53 11 $      241.40 $                      28.53 $ 1,412.43 12 $      262.70 $                      28.39 2 $ 1,405.37 13 $      283.88 $                      28.25 $ 1,398.35 14 $      304.96 $                      28.11 $ 1,391.35 15 $      325.94 $                      27.97 $ 1,384.40 16 $      346.81 $                      27.83 $ 1,377.47 17 $      367.58 $                      27.69 $ 1,370.59 18 $      388.24 $                      27.55 $ 1,363.73 19 $      408.80 $                      27.41 $ 1,356.92 20 $      429.25 $                      27.27 $ 1,350.13 21 $      449.61 $                      27.14 $ 1,343.38 22 $      469.86 $                      27.00 $ 1,336.66 23 $      490.01 $                      26.87 $ 1,329.98 24 $      510.06 $                      26.73

Explanation / Answer

<script type="text/javascript">


var curBal;
var IRate;

curbal1=document.writeln("Enter your current balance:");
IRate=docuement.writeln(Enter the yearly interest rate:);

var InitialBalance=parseFloat(curBal1);
var InterestRate=parseDouble(IRate);

monthlyPayment = 0;
monthlyInterestRate = InterestRate/12
balance = InitialBalance;


function calculate()
{


while balance > 0:
monthlyPayment += 10
balance = InitialBalance
numMonths = 0

while numMonths < 12 and balance > 0:

numMonths += 1

interest = monthlyInterestRate * balance

balance -= monthlyPayment

balance += interest

balance = round(balance,2)
document.writeln("RESULT");
document.writeln("Monthly payment to pay off debt in 1 year: " +monthlyPayment);
document.writeln("Number of months need to pay the debt: "+numMonths);
document.writeln("Balance after debt is paid: "+balance);