Testing Sanity

The core task of software development is sanity testing.

  • warning: Creating default object from empty value in /home2/thepalls/public_html/cgpsoftware/modules/taxonomy/taxonomy.pages.inc on line 34.
  • warning: Parameter 2 to gmap_gmap() expected to be a reference, value given in /home2/thepalls/public_html/cgpsoftware/includes/module.inc on line 483.
  • strict warning: Non-static method view::load() should not be called statically in /home2/thepalls/public_html/cgpsoftware/sites/all/modules/views/views.module on line 879.

calculator running heart rate

Posted by cgp

I wrote a heart rate calculator. This has been done, many, many times.

function HeartRateCalculator(resting, max) {
this.resting = resting;
this.max = max;
this.reserve = this.max - this.resting;
this.lower = (this.reserve * 0.6) + this.resting;
this.upper = (this.reserve * 0.8) + this.resting;
this.target = (this.lower + this.upper) / 2;
}


It basically looks like:
function HeartRateCalculator(resting, max) {
this.resting = resting;
this.max = max;
this.reserve = this.max - this.resting;
this.lower = (this.reserve * 0.6) + this.resting;
this.upper = (this.reserve * 0.8) + this.resting;
this.target = (this.lower + this.upper) / 2;
}


Resting:
Max: (You can calculate this here)

$(function() {
$('#calcTHR').click(function() {
var resting = parseInt($('#restingHR').val())
var max = parseInt($('#maxHR').val());
var heartRateCalculator = new HeartRateCalculator(resting, max);
var heartRateHtml = "Target Heart Rate = " + heartRateCalculator.target;
$('#results').html(heartRateHtml);
});
});