Create a webpage (the last picture has three potential offers not just 2). Use html, JavaScript and CSS where needed. All information needed is supplied by the picture.
Hi,
Please follow the below steps to complete your assignment.
Step 1. Create 4 text fields and 1 "Add option" button in html
page.
<input type="text"
id="purchase">
<input type="text"
id="cashIncentive">
<input type="text"
id="term">
<input type="text" id="rate">
<input type="button" id="addoption" value="Add option">
Step 2. Validate text fields.
var purchase =
$("#purchase").val();
if (purchase >= 0 && purchase
<=100000) {
alert("Please enter valid purchase price.")
}
var term = $("#term").val(); //
monthly
if (term >= 24 &&
term <=72) {
alert("Please enter valid term in months.")
}
var interestRate =
$("#rate").val();
if (interestRate >= 0.0
&& interestRate <=10.0) {
alert("Please enter valid interest rate.")
}
var cashIncentive =
$("#cashIncentive").val();
Step 3. Calculate monthly payment and total cost
var purchase =
$("#purchase").val();
var term = $("#term").val(); // monthly
var cashIncentive = $("#cashIncentive").val();
var interestRate = $("#rate").val();
if(cashIncentive !=
""){
purchase = purchase -
cashIncentive;
}
var termIntRatio = (interestRate/100)/12;
var termInterest = (termIntRatio*interestRate);
var top =
Math.pow((1+termIntRatio),term);
var bottom = top
-1;
var sp = top /
bottom;
var monthly =
((purchase * termIntRatio) * sp);
var monthly = monthly.toFixed(2);
var totalcost = monthly*term;
Step 4. Create offers counter variable for count the offers on "Add option" button and remove offers for display Offer 1, Offer 2 etc.
Step 5. Use style="border : 2px solid" in <div> of
particular offer for display in box.
Create a webpage (the last picture has three potential offers not just 2). Use html, JavaScript...