I am looking to create a calculator that can determine the financial cost of experiencing anger.
While I may not be the best at articulating the issue, I will do my utmost to explain it. Users are required to input their age, salary, hours worked per day, frequency of work-related anger incidents, and duration of each angry episode.
I have an Excel formula prepared (for those skilled enough to understand) along with some code that I have been working on. You can access the Excel file and code through this link: __
To better grasp the concept, you may need to refer to the Excel file (I apologize for any confusion caused by my poor English skills).
I also have HTML and JavaScript code snippets that I attempted to write; however, I had to remove certain parts to comply with Stack Overflow requirements.
Thank you all for your help and support.
HTML
<div class="login">
<form method="post">
<p> Enter your age </p>
<input id="user_age" type="text" name="a" value="0" required="required" />
<p>Enter your salary or income ($) </p>
<input id="user_salary" type="text" name="b" value="0" required="required" />
<p> Enter Work hours per day </p>
<input id="user_work" type="text" name="x" value="0" required="required" />
<p> How often do you get angry per day during work.</p>
<input id="user_time" type="text" name="c" value="0" required="required" />
<p> How many hours does the average anger last? </p>
<input id="user_anger" type="text" name="d" value="0" required="required" />
<p id="results"></p>
<input type="button" class="button" value="Calculate">
</form>
JavaScript code
function calcAnger () {
var sixty = 60;
var age = parseFloat(document.getElementById('user_age').value);
var salary = parseFloat(document.getElementById('user_salary').value);
var workTime = parseFloat(document.getElementById('user_work').value);
var angerDay = parseFloat(document.getElementById('user_time').value);
var angerLast = parseFloat(document.getElementById('user_anger').value);
var calculate = "Your cost of anger: $" + ' ' + age * salary* 243 * workTime * angerDay * angerLast * 2;
document.getElementById ('results').innerHTML = calculate;
return false;
calculate.style.color = "#ff0000";