function calculateFinancials() {
var principal = parseFloat(document.getElementById(‘principal’).value);
var rate = parseFloat(document.getElementById(‘rate’).value) / 100;
var time = parseFloat(document.getElementById(‘time’).value);
if (isNaN(principal) || isNaN(rate) || isNaN(time)) {
alert(‘Please enter valid numbers for all fields.’);
return;
}
var totalAmount = principal * (1 + rate * time);
document.getElementById(‘result’).value = totalAmount.toFixed(2);
}
function resetFinancials() {
document.getElementById(‘financial-calculator-form’).reset();
document.getElementById(‘result’).value = ”;
}
function toggleDetails() {
var details = document.getElementById(‘calculation-details’);
if (details.style.display === ‘none’ || details.style.display === ”) {
details.style.display = ‘block’;
} else {
details.style.display = ‘none’;
}
}