It is necessary to write the logic of the deposit calculator.
You need to calculate how much interest will be charged for the billing period and add them to the initial amount.
For periods of 3 and 6 months, remember that interest is calculated on a yearly basis and will be lower for these periods.
The calculated amount upon completion of the deposit must be displayed inside the span
in h2
.
If only the amount is entered, but interest cannot be calculated (no period or program is selected), we show the initial amount.
The amount should change whenever the values ββof any field change.
Use the internal script, input
event, don’t change anything in the HTML code.
This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task
index.html
a<!DOCTYPE html>
<html>
<head>
<title>Deposit calculator</title>
<style>
input, select {
margin-right: 32px;
}
label {
margin-right: 8px;
}
</style>
</head>
<body>
<form name="deposit">
<label for="initial">Initial sum ($)</label>
<input type="number" name="initial" id="initial">
<label for="period">Period (month)</label>
<select name="period" id="period">
<option value="0">Select period (month)</option>
<option value="3">3 months</option>
<option value="6">6 months</option>
<option value="12">12 months</option>
</select>
<label for="program">Program (%)</label>
<select name="program" id="program">
<option value="0">Select program</option>
<option value="4.5">Saving deposit program - 4.5%</option>
<option value="5">Deposit Universal - 5%</option>
</select>
<h2>You will get ($): <span>0</span></h2>
</form>
</body>
</html>