Calculators-Free.com https://calculators-free.com Free Calculators & Free Source Code Sun, 21 Aug 2022 07:20:21 +0000 en-US hourly 1 https://wordpress.org/?v=5.2.21 https://calculators-free.com/wp-content/uploads/2019/11/cropped-fav-32x32.png Calculators-Free.com https://calculators-free.com 32 32 Tip Calculator https://calculators-free.com/tip-calculator https://calculators-free.com/tip-calculator#respond Sat, 16 Nov 2019 16:53:20 +0000 https://calculators-free.com/?p=152 Introduction | Demonstration Calculator | Source Code

How The Tip Calculator Works

This is a simple calculator for calculating a tip and splitting the bill between several people. Enter in the amount of the bill, the tip percentage, and the number of people paying. Then click ”Calculate” to get your results.

If you change the values, click the “Calculate” button again to get a new result.

Introduction | Demonstration Calculator | Source Code

Demonstration Calculator


Tip Calculator

Bill Amount:

Number of People:

Tip Percentage:

Tip Per Person:

Total Per Person:

Full Amount:

Introduction | Demonstration Calculator | Source Code

Tip Calculator Source Code

This calculator is licensed to you under Creative Commons Attribution 3.0. If you would like to use the source code on your site or create a derivative work from it, you must include the following HTML on the page where the calculator appears. We’re giving you this code for free with a legal license to use it. All you have to do is credit us in the manner we specify.

Required Credit HTML

INSTALLATION

Just cut and paste the Javascript code and HTML form below into your page. If you want to customize the appearance of the form, feel free. Just make sure the input name and form id/name values are not changed.


<script type="text/javascript">


function calcTip() {

var formvals = getFormVal();

var totalPeople = formvals[0];

var percentageTotal = formvals[1];

var billAmount = formvals[2];

//tip per person

var total = ((billAmount * percentageTotal) * .01) / totalPeople;

total = Math.round(total * 100) / 100;

total = total.toFixed(2);

//total per person

var totalPerson = ((total * totalPeople) + billAmount) / totalPeople;

totalPerson = Math.round(totalPerson * 100) / 100;

totalPerson = totalPerson.toFixed(2);

//full amount due

var fullAmount = ((total * totalPeople) + billAmount);

fullAmount = Math.round(fullAmount * 100) / 100;

fullAmount = fullAmount.toFixed(2);
	
document.getElementById("tip").innerHTML = "$"+total;	

document.getElementById("totp").innerHTML = "$"+totalPerson;

document.getElementById("fa").innerHTML = "$"+fullAmount;

}


function getFormVal(){
	
        var totalPeople = parseInt(document.wcbubba.people.value);

        var billAmount = parseInt(document.wcbubba.bill.value);

        var percentageTotal = parseFloat(document.wcbubba.percentage.value);

        if((totalPeople <= 0)||(isNaN(totalPeople))) totalPeople = 1;

        if((percentageTotal <= 0)||(isNaN(percentageTotal))) percentageTotal = 1;

        if((billAmount <= 0)||(isNaN(billAmount))) billAmount = 1;

        var mike = new Array(totalPeople,percentageTotal,billAmount);

       return mike;

}


</script>

<form id="wcbubba" name="wcbubba" action="javascript:void();">

Bill Amount: <input type=text name="bill" size=8>

Number of People: <input type=text name="people" size=8>

Tip Percentage: <input type=text name="percentage" size=8>

<br /><br />

<input type="submit" value="calculate" onClick="calcTip();"> 

<br /><br />

</form>

<p><b>Tip Per Person:</b> <span id="tip"></p><br />

<p><b>Total Per Person:</b> <span id="totp"></p><br />

<p><b>Full Amount:</b> <span id="fa"></p><br />


]]>
https://calculators-free.com/tip-calculator/feed/ 0
Your Weight in SPAM® Calculator https://calculators-free.com/weight-worth-in-spam https://calculators-free.com/weight-worth-in-spam#respond Mon, 11 Nov 2019 08:08:33 +0000 https://calculators-free.com/?p=83 Introduction | Demonstration Calculator | Source Code

How This Calculator Works

Find out how much you’d be worth if you were worth your weight in SPAM®, with this fun calculator.

Just enter your body weight, actual price of SPAM, and press the “calculate” button to find out how much your weight is worth in SPAM. By default, the price of SPAM is $0.00684 per gram ($13.99 for six 12-ounce cans).

Introduction | Demonstration Calculator | Source Code

Demonstration Calculator

Your Weight:

Price of SPAM (in dollars):
per

Introduction | Demonstration Calculator | Source Code

Your Weight in SPAM® Calculator Source Code

This calculator is licensed to you under Creative Commons Attribution 3.0. If you would like to use the source code on your site or create a derivative work from it, you must include the following HTML on the page where the calculator appears. We’re giving you this code for free with a legal license to use it. All you have to do is credit us in the manner we specify.

Required Credit HTML

INSTALLATION

Just cut and paste the Javascript code and HTML form below into your page. If you want to customize the appearance of the form, feel free. Just make sure the input name and form id/name values are not changed.



<script type="text/javascript">
function calcWeightSPAM(){

// GET VALUES FROM FORM, SET VALUE TO ONE IF THE VALUE IN THE FORM IS NOT A NUMBER

var weight = (isNaN(document.wcbubba.weight.value)) ? 1 : document.wcbubba.weight.value;
var price = (isNaN(document.wcbubba.price.value)) ? 1 : document.wcbubba.price.value;
var wis = document.wcbubba.wis.value;
var wospam = document.wcbubba.wospam.value;

if(wis == "pound"){weight = weight / 2.205;}

if(wospam == "ounce"){price = price * 28.3495;}

// DO CALCULATION

var result = parseInt((weight * 1000 * price) * 100) / 100;

var expout = 'Your weight in SPAM® is worth: $' + result;

document.getElementById('totals').innerHTML = expout;

}
</script>

<form name="wcbubba" action="javascript:void();">

Your Weight:<br>
<input name="weight" size="5" type="text" />

<select name="wis" size="1">
<option value="kilogram" selected="selected">kg</option>
<option value="pound">pounds</option>
</select><br><br>

Price of SPAM (in dollars):<br>
<input name="price" size="5" type="text" value="0.00684" /> per 

<select name="wospam" size="1">
<option value="gram" selected="selected">gram</option>
<option value="ounce">ounce</option>
</select>

<input type="submit" value="calculate" onclick="calcWeightSPAM()"></form><br>

<div id="totals" style="padding-top:1em;padding-bottom:2em"></div>

]]>
https://calculators-free.com/weight-worth-in-spam/feed/ 0
Simple Mortgage Payment Calculator https://calculators-free.com/simple-mortgage-payment-calculator-1 https://calculators-free.com/simple-mortgage-payment-calculator-1#respond Sun, 22 Sep 2019 18:56:00 +0000 https://calculators-free.com/?p=25 Introduction | Demonstration Calculator | Source Code

How The Mortgage Payment Calculator Works

This is a very simple calculator for calculating a mortgage payment. Enter in the amount of the loan, the number of years the loan is for, and the APR. Then click “Calculate Payment” to get your monthly mortgage payment.

If you change the values, click the “Calculate Payment” button again to get a new result.

Introduction | Demonstration Calculator | Source Code

Demonstration Calculator


Simple Mortgage Calculator

Loan Amount:

Loan Term: years

APR Interest:

Payment:

Introduction | Demonstration Calculator | Source Code

Simple Mortgage Payment Calculator Source Code

 

This calculator is licensed to you under Creative Commons Attribution 3.0. If you would like to use the source code on your site or create a derivative work from it, you must include the following HTML on the page where the calculator appears. We’re giving you this code for free with a legal license to use it. All you have to do is credit us in the manner we specify.

Required Credit HTML

INSTALLATION

Just cut and paste the Javascript code and HTML form below into your page. If you want to customize the appearance of the form, feel free. Just make sure the input name and form id/name values are not changed.


<script type="text/javascript">
function calcLoan() {

var formvals = getFormVal();

var years = formvals[0];
var months = years * 12;

var loan = formvals[2];
var apr = formvals[1];

var mpr = apr / 1200;
var nfactor = 0 - months;
var mofactor = Math.pow((1 + mpr), nfactor);
var bofactor = 1 - mofactor;
var tofactor = mpr / bofactor;

var payment = loan * tofactor;
var reducto = Math.round(payment*100)/100;

document.wcbubba.payment.value = "$"+reducto;

if (amortsub) showAm();

}

function getFormVal(){

          var years = parseInt(document.wcbubba.term.value);
          var loan = parseInt(document.wcbubba.loan.value);
          var apr = parseFloat(document.wcbubba.apr.value);

          if((years <= 0)||(isNaN(years))) years = 1;
          if((apr <= 0)||(isNaN(apr))) apr = 1;
          if((loan <= 0)||(isNaN(loan))) loan = 1;

          var mike = new Array(years,apr,loan);

         return mike;
}
</script>

<form id="wcbubba" name="wcbubba" action="javascript:void();">

Loan Amount: <input type=text name="loan" size=8>

Loan Term: <input type=text name="term" size=8> years

APR Interest: <input type=text name="apr" size=8>

<br /><br />

<input type="submit" value="Calculate Payment" onClick="calcLoan();"> 

<br /><br />

<b>Payment:</b> <input type=text name = "payment" size=9><br>
</form></p>
]]>
https://calculators-free.com/simple-mortgage-payment-calculator-1/feed/ 0
BMR And Daily Calories Burned Calculator https://calculators-free.com/bmr-and-daily-calories-burned-calculator-9 https://calculators-free.com/bmr-and-daily-calories-burned-calculator-9#respond Wed, 07 Aug 2019 19:03:57 +0000 https://calculators-free.com/?p=9 Introduction | Demonstration Calculator | Source Code

How The BMR & Daily Calories Burned Calculator Works

How many calories do you need to eat in a day to maintain your current weight? That’s different for each and every individual. The only way to get a highly accurate number is a lab test where you sleep at the lab and they take measurements right as you wake up from 8 hours of sleep and at least 12 hours of fasting.

This calculator uses the formula for Basal Metabolic Rate (BMR) devised by doctors at the University of Nevada Medical School and published in the American Journal of Clinical Nutrition in 1990, then uses the Harris Benedict activity multiplier to determine your estimated daily caloric burn off.

Remember that the Basal Metabolic Rate is how many calories you’d need to maintain your body weight if all you did all day was lay in bed and your only activity was eating. Just sitting up and typing a few hours a day, walking from the couch to your car, from the car to your office, etc. boosts your daily needs up by 20%. If you lead a lifestyle where you have high levels of exertion every day, it can nearly double your calorie needs.

Just fill out the fields in the form below and click “calculate my calorie needs” to get your BMR and your daily calorie needs.

Introduction | Demonstration Calculator | Source Code

Demonstration Calculator

Weight:

Age:
(in years)

Gender:

Height:

Activity Level:

Your Basal Metabolic Rate is:

Your Average Daily Calorie Need is:

Introduction | Demonstration Calculator | Source Code

Daily Calorie Needs Calculator Source Code

This calculator is licensed to you under Creative Commons Attribution 3.0. If you would like to use the source code on your site or create a derivative work from it, you must include the following HTML on the page where the calculator appears. We’re giving you this code for free with a legal license to use it. All you have to do is credit us in the manner we specify.

Required Credit HTML

INSTALLATION

Just cut and paste the Javascript code and HTML form below into your page. If you want to customize the appearance of the form, feel free. Just make sure the input name and form id/name values are not changed.



<script type="text/javascript">

function calcNeeds(){

var weight = (isNaN(document.wcbubba.weight.value)) ? 0 : document.wcbubba.weight.value;
if (weight == 0) alert("Results will be inaccurate.  Weight is not a valid number.");
var height = (isNaN(document.wcbubba.height.value)) ? 0 : document.wcbubba.height.value;
if (height == 0) alert("Results will be inaccurate.  Height is not a valid number.");
var age = (isNaN(document.wcbubba.height.value)) ? 0 : document.wcbubba.age.value;
if (age == 0) alert("Results will be inaccurate.  Age is not a valid number.");
var activity = (isNaN(document.wcbubba.activity.value)) ? 0 : document.wcbubba.activity.value;

var wmult = (document.wcbubba.units.value == "pounds") ? 2.204 : 1;
var hmult = (document.wcbubba.hunits.value == "inches") ? 2.54 : 1;
var genvar = (document.wcbubba.gender.value == "male") ? 5 : -161;

var BMR = Math.round((((weight / wmult) * 9.99) + ((height * hmult) * 6.25) - (age * 4.92) + genvar) * 1);

var calburn = Math.round((((weight / wmult) * 9.99) + ((height * hmult) * 6.25) - (age * 4.92) + genvar) * activity);

document.getElementById('results').innerHTML = "Your Basal Metabolic Rate is: " + BMR + " calories.<br><br>Your Average Daily Calorie Need Is: " + calburn + " calories";

}
</script>

<form name="wcbubba" id="wcbubba" action="javascript:void()">
Weight:<br> <input type=text name="weight" size="6"> <select name="units"><option value="pounds">pounds<option value="kilos">kg</select><br><br>
Age:<br><input type=text name="age" size="6"> (in years)<br><br>
Gender:<br><select name="gender"><option value="male">male<option value="female">female</select><br><br>
Height:<br> <input type=text name="height" size="6"> <select name="hunits"><option value="inches">inches<option value="cm">cm</select><br><br>
Activity Level:<br> <select name="activity">
<option value="1.2">Little or no exercise and desk job
<option value="1.375">Lightly strenuous exercise or casual sports 1-3 days a week
<option value="1.55">Moderately strenuous exercise or somewhat aggressive sports 3-5 days a week
<option value="1.725">Strenuous exercise or aggressive sports 6-7 days a week
<option value="1.9">Strenuous daily exercise or aggressive sports and a physically active job</select><br><br>
<input type="submit" value="Calculate My Calorie Needs" onClick="calcNeeds();"></form><br>
<div id="results" style="border:1px solid #000;padding:4px;font-size:15px;font-weight:bold;width:400px;">
Your Basal Metabolic Rate is:<br><br>
Your Average Daily Calorie Need is:
</div>

]]>
https://calculators-free.com/bmr-and-daily-calories-burned-calculator-9/feed/ 0
Body Mass Index (BMI) Calculator https://calculators-free.com/body-mass-index-bmi-calculator-10 https://calculators-free.com/body-mass-index-bmi-calculator-10#respond Wed, 10 Jul 2019 18:25:56 +0000 https://calculators-free.com/?p=15 Introduction | Demonstration Calculator | Source Code

How The Body Mass Index (BMI) Calculator Works

Body Mass Index (BMI) is a general indicator of whether or not you are maintaining a healthy weight based on the ratio of your weight to your height. It’s an imperfect scale as it doesn’t account for differences in body types. For example, a 5 foot 9 inch bodybuilder who weighs 215 pounds and has a 6% body fat would be labeled obese. And there is already a new scale just for people from Southeast Asia where the ranges are lowered.

While it can be a good indicator of the healthiness of your weight if you fall within certain statistical norms that were used to develop it, it should be taken with a significant grain of salt and should not be used as a substitute for a professional evaluation of your health by a doctor.

Introduction | Demonstration Calculator | Source Code

Demonstration Calculator


Weight:

Height:

Your BMI is:

Introduction | Demonstration Calculator | Source Code

Body Mass Index (BMI) Calculator Source Code

This calculator is licensed to you under Creative Commons Attribution 3.0. If you would like to use the source code on your site or create a derivative work from it, you must include the following HTML on the page where the calculator appears. We’re giving you this code for free with a legal license to use it. All you have to do is credit us in the manner we specify.

Required Credit HTML

INSTALLATION

Just cut and paste the Javascript code and HTML form below into your page. If you want to customize the appearance of the form, feel free. Just make sure the input name and form id/name values are not changed.

<script type="text/javascript">

function calcBMI(){

// Get Variables and validate to make sure they're numbers, 
// setting them to a value of 1 if they're not.

var weight = (isNaN(document.wcbubba.weight.value)) ? 1 : document.wcbubba.weight.value;

if (weight == 0) alert("Results will be inaccurate.  Weight is not a valid number.");

var height = (isNaN(document.wcbubba.height.value)) ? 1 : document.wcbubba.height.value;

if (height == 0) alert("Results will be inaccurate.  Height is not a valid number.");

// set multipliers based on whether metric or English units were selected

var wmult = (document.wcbubba.units.value == "pounds") ? 2.204 : 1;

// Turns inches/centimeters into meters

var hmult = (document.wcbubba.hunits.value == "inches") ? .0254 : .01;

// Do the calculation (weight in kg divided by the height in meters 
// times itself). The multiplication by 10 and then division by ten
// work in conjunction with Math.round() to round the value to one
// decimal place of precision.

var BMI = Math.round(((weight / wmult)/((height * hmult)*(height * hmult))) *10)/10;

// get the analysis - note this is for general purpose, there is a separate scale for
// Southeast Asian people and there may be more variants on the way

var result = "";
if(BMI < 16.5) result = "severely underweight";
else if((BMI >=16.5)&&(BMI<=18.49)) result = "underweight";
else if((BMI >=18.5)&&(BMI<=25)) result = "normal";
else if((BMI >=25.01)&&(BMI<=30)) result = "overweight";
else if((BMI >=30.01)&&(BMI<=35)) result = "obese";
else if((BMI >=35.01)&&(BMI<=40)) result = "clinically obese";
else result = "morbidly obese";

document.getElementById('results').innerHTML = "Your Body Mass Index (BMI) is: " + BMI + ".<br><br>This would be considered " + result + ".";

}
</script>

<form name="wcbubba" id="wcbubba" action="javascript:void()">
Weight:<br> <input type=text name="weight" size="6"> <select name="units"><option value="pounds">pounds<option value="kilos">kg</select><br><br>

Height:<br> <input type=text name="height" size="6"> <select name="hunits"><option value="inches">inches<option value="cm">cm</select><br><br>

<input type="submit" value="Calculate My BMI" onClick="calcBMI();"></form><br>

<div id="results" style="border:1px solid #000;padding:4px;font-size:15px;font-weight:bold;width:400px;">
Your BMI is:<br><br>
</div>

]]>
https://calculators-free.com/body-mass-index-bmi-calculator-10/feed/ 0
Auto Loan Payment Calculator with Amortization https://calculators-free.com/auto-loan-payment-calculator-with-amortization-12 https://calculators-free.com/auto-loan-payment-calculator-with-amortization-12#respond Thu, 27 Jun 2019 03:43:18 +0000 https://calculators-free.com/?p=19 Introduction | Demonstration Calculator | Source Code

How The Auto Loan Payment with Amortization Works

This calculator uses the same mathematical functions as our Simple Auto Loan Calculator, but iterates through each payment, calculating the interest and principal amounts for each payment as you pay off the loan.

Introduction | Demonstration Calculator | Source Code

Demonstration Calculator

Loan Amount:
Loan Term: months
APR Interest:

Payment:

Introduction | Demonstration Calculator | Source Code

Auto Loan Payment with Amortization Source Code

This calculator is licensed to you under Creative Commons Attribution 3.0. If you would like to use the source code on your site or create a derivative work from it, you must include the following HTML on the page where the calculator appears. We’re giving you this code for free with a legal license to use it. All you have to do is credit us in the manner we specify.

Required Credit HTML

INSTALLATION

Just cut and paste the Javascript code and HTML form below into your page. If you want to customize the appearance of the form, feel free. Just make sure the input name and form id/name values are not changed.


<script type="text/javascript">

var amortsub = false;

function calcLoan() {

var formvals = getFormVal();

var years = formvals[0];
var months = years;

var loan = formvals[2];
var apr = formvals[1];

var mpr = apr / 1200;
var nfactor = 0 - months;
var mofactor = Math.pow((1 + mpr), nfactor);
var bofactor = 1 - mofactor;
var tofactor = mpr / bofactor;

var payment = loan * tofactor;
var reducto = Math.round(payment*100)/100;

document.wcbubba.payment.value = "$"+reducto;

if (amortsub) showAm();

}

function showAm(){

amortsub = true;

formvals = getFormVal();

var years = formvals[0];
var months = years;

var loan = formvals[2];
var apr = formvals[1];

var mpr = apr / 1200;
var nfactor = 0 - months;
var mofactor = Math.pow((1 + mpr), nfactor);
var bofactor = 1 - mofactor;
var tofactor = mpr / bofactor;

var payment = loan * tofactor;
var reducto = Math.round(payment*100)/100;

document.wcbubba.payment.value = "$"+reducto;

// NOW WE CALCULATE THE AMORTIZATION

var intpaid = 0;
var princpaid = 0;
var factsout = "";
var inyear = 0;
var inmonth = 0;

document.getElementById('amortsub').innerHTML = '<b style="font-size:19px;">MONTHLY AMORTIZATION</b><br><br>';

for(var i=0;i<months;i++){
intpaid = Math.round((mpr * loan) *100)/100;
princpaid = Math.round((reducto - intpaid)*100)/100;
loan = Math.round((loan - princpaid)*100)/100;

inyear = parseInt(i/12);
inmonth = i - (inyear * 12);

factsout += '<b>Year ' + (inyear + 1) + ' Month ' + (inmonth +1) + ':</b><br>   Principal Paid: $' + princpaid + '<br>   Interest Paid: $' + intpaid + '<br>   Principal Remaining: $' + loan + '<br>';

}
document.getElementById('amortsub').innerHTML += factsout;

flush();

}

function getFormVal(){

var years = parseInt(document.wcbubba.term.value);
var loan = parseInt(document.wcbubba.loan.value);
var apr = parseFloat(document.wcbubba.apr.value);

if((years <= 0)||(isNaN(years))) years = 1;
if((apr <= 0)||(isNaN(apr))) apr = 1;
if((loan <= 0)||(isNaN(loan))) loan = 1;

var mike = new Array(years,apr,loan);

return mike;
}

</script>

<form id="wcbubba" name="wcbubba" action="javascript:void();">
Loan Amount: <input type=text name="loan" size=8><br>
Loan Term: <input type=text name="term" size=8> months<br>
APR Interest: <input type=text name="apr" size=8><br><ber>

<input type="submit" value="Calculate Payment" onClick="calcLoan();"> <b>Payment:</b> <input type=text name = "payment" size=9><br>
<input type="submit" value="Show Amortization" onClick="showAm();">
</form><br><br>

<div id="amortsub">

</div> 
]]>
https://calculators-free.com/auto-loan-payment-calculator-with-amortization-12/feed/ 0
Simple Auto Loan Calculator https://calculators-free.com/simple-auto-loan-calculator-7 https://calculators-free.com/simple-auto-loan-calculator-7#respond Sun, 12 May 2019 01:47:56 +0000 https://calculators-free.com/?p=23 Introduction | Demonstration Calculator | Source Code

How The Auto Loan Payment Calculator Works

This is a very simple calculator for calculating an auto loan payment. Enter in the amount of the loan, the number of months the loan is for, and the APR. Then click “Calculate Payment” to get your monthly auto loan payment.

If you change the values, click the “Calculate Payment” button again to get a new result.

Introduction | Demonstration Calculator | Source Code

Demonstration Calculator


Simple Auto Loan Calculator

Loan Amount:

Loan Term: months

APR Interest:

Payment:

Introduction | Demonstration Calculator | Source Code

Simple Auto Loan Payment Calculator Source Code

This calculator is licensed to you under Creative Commons Attribution 3.0. If you would like to use the source code on your site or create a derivative work from it, you must include the following HTML on the page where the calculator appears. We’re giving you this code for free with a legal license to use it. All you have to do is credit us in the manner we specify.

Required Credit HTML

INSTALLATION

Just cut and paste the Javascript code and HTML form below into your page. If you want to customize the appearance of the form, feel free. Just make sure the input name and form id/name values are not changed.


<script type="text/javascript">
function calcLoan() {

var formvals = getFormVal();

var months = formvals[0];

var loan = formvals[2];
var apr = formvals[1];

var mpr = apr / 1200;
var nfactor = 0 - months;
var mofactor = Math.pow((1 + mpr), nfactor);
var bofactor = 1 - mofactor;
var tofactor = mpr / bofactor;

var payment = loan * tofactor;
var reducto = Math.round(payment*100)/100;

document.wcbubba.payment.value = "$"+reducto;

if (amortsub) showAm();

}

function getFormVal(){

          var years = parseInt(document.wcbubba.term.value);
          var loan = parseInt(document.wcbubba.loan.value);
          var apr = parseFloat(document.wcbubba.apr.value);

          if((years <= 0)||(isNaN(years))) years = 1;
          if((apr <= 0)||(isNaN(apr))) apr = 1;
          if((loan <= 0)||(isNaN(loan))) loan = 1;

          var mike = new Array(years,apr,loan);

         return mike;
}
</script>

<form id="wcbubba" name="wcbubba" action="javascript:void();">

Loan Amount: <input type=text name="loan" size=8>

Loan Term: <input type=text name="term" size=8> months

APR Interest: <input type=text name="apr" size=8>

<br /><br />

<input type="submit" value="Calculate Payment" onClick="calcLoan();"> 

<br /><br />

<b>Payment:</b> <input type=text name = "payment" size=9><br>
</form></p>
]]>
https://calculators-free.com/simple-auto-loan-calculator-7/feed/ 0
Mortgage Calculator With Amortization https://calculators-free.com/mortgage-calculator-with-amortization-11 https://calculators-free.com/mortgage-calculator-with-amortization-11#respond Fri, 05 Apr 2019 03:31:47 +0000 https://calculators-free.com/?p=21 Introduction | Demonstration Calculator | Source Code

How The Mortgage Calculator with Amortization Works

This calculator uses the same mathematical functions as our Simple Mortgage Payment Calculator, but creates a loop, going through all the months and calculating the interest to principal ratios for each payment as you pay down the principal each month.

The amortization display is very simple. The output for each month is generated by one line of code…


factsout += '<b>Year ' + (inyear + 1) + ' Month ' + (inmonth +1) + ':</b><br>   Principal Paid: $' + princpaid + '<br>   Interest Paid: $' + intpaid + '<br>   Principal Remaining: $' + loan + '<br>';

If you’re familiar with HTML and just have a basic knowledge of JavaScript, you can edit that to add all sorts of formatting goodness to your output.

Introduction | Demonstration Calculator | Source Code

Demonstration Calculator

Loan Amount:
Loan Term: years
APR Interest:

Payment:

Introduction | Demonstration Calculator | Source Code

Mortgage Calculator with Amortization Source Code

This calculator is licensed to you under Creative Commons Attribution 3.0. If you would like to use the source code on your site or create a derivative work from it, you must include the following HTML on the page where the calculator appears. We’re giving you this code for free with a legal license to use it. All you have to do is credit us in the manner we specify.

Required Credit HTML

INSTALLATION

Just cut and paste the Javascript code and HTML form below into your page. If you want to customize the appearance of the form, feel free. Just make sure the input name and form id/name values are not changed.



<script type="text/javascript">

var amortsub = false;

function calcLoan() {

var formvals = getFormVal();

var years = formvals[0];
var months = years * 12;

var loan = formvals[2];
var apr = formvals[1];

var mpr = apr / 1200;
var nfactor = 0 - months;
var mofactor = Math.pow((1 + mpr), nfactor);
var bofactor = 1 - mofactor;
var tofactor = mpr / bofactor;

var payment = loan * tofactor;
var reducto = Math.round(payment*100)/100;

document.wcbubba.payment.value = "$"+reducto;

if (amortsub) showAm();

}

function showAm(){

amortsub = true;

formvals = getFormVal();

var years = formvals[0];
var months = years * 12;

var loan = formvals[2];
var apr = formvals[1];

var mpr = apr / 1200;
var nfactor = 0 - months;
var mofactor = Math.pow((1 + mpr), nfactor);
var bofactor = 1 - mofactor;
var tofactor = mpr / bofactor;

var payment = loan * tofactor;
var reducto = Math.round(payment*100)/100;

document.wcbubba.payment.value = "$"+reducto;

// NOW WE CALCULATE THE AMORTIZATION

var intpaid = 0;
var princpaid = 0;
var factsout = "";
var inyear = 0;
var inmonth = 0;

document.getElementById('amortsub').innerHTML = '<b style="font-size:19px;">MONTHLY AMORTIZATION</b><br><br>';

for(var i=0;i<months;i++){
intpaid = Math.round((mpr * loan) *100)/100;
princpaid = Math.round((reducto - intpaid)*100)/100;
loan = Math.round((loan - princpaid)*100)/100;

inyear = parseInt(i/12);
inmonth = i - (inyear * 12);

factsout += '<b>Year ' + (inyear + 1) + ' Month ' + (inmonth +1) + ':</b><br>   Principal Paid: $' + princpaid + '<br>   Interest Paid: $' + intpaid + '<br>   Principal Remaining: $' + loan + '<br>';

}
document.getElementById('amortsub').innerHTML += factsout;

flush();

}

function getFormVal(){

var years = parseInt(document.wcbubba.term.value);
var loan = parseInt(document.wcbubba.loan.value);
var apr = parseFloat(document.wcbubba.apr.value);

if((years <= 0)||(isNaN(years))) years = 1;
if((apr <= 0)||(isNaN(apr))) apr = 1;
if((loan <= 0)||(isNaN(loan))) loan = 1;

var mike = new Array(years,apr,loan);

return mike;
}

</script>

<form id="wcbubba" name="wcbubba" action="javascript:void();">
Loan Amount: <input type=text name="loan" size=8><br>
Loan Term: <input type=text name="term" size=8> years<br>
APR Interest: <input type=text name="apr" size=8><br><ber>

<input type="submit" value="Calculate Payment" onClick="calcLoan();"> <b>Payment:</b> <input type=text name = "payment" size=9><br>
<input type="submit" value="Show Amortization" onClick="showAm();">
</form><br><br>

<div id="amortsub">

</div> 
]]>
https://calculators-free.com/mortgage-calculator-with-amortization-11/feed/ 0
Smoking Calculator https://calculators-free.com/smoking-calculator-13 https://calculators-free.com/smoking-calculator-13#respond Fri, 22 Feb 2019 15:43:15 +0000 https://calculators-free.com/?p=17 Introduction | Demonstration Calculator | Source Code

How The Smoking Calculator Works

This calculator takes the number of years you smoked, average number of cigarettes you smoked a day, and the current price for a pack of cigarettes and delivers a few figures:

  • Number of cigarettes you smoked in that period.
  • How much all those cigarettes would cost today.
  • How much the tobacco in those cigarettes weighed (based on 0.68 grams per cigarette).

The results can be pretty surprising. I smoked around 3/4 of a pack a day for 23 years. That turned out to be over 126,000 cigarettes, costing more than $37,000 and with tobacco weighing in at over 188 pounds. I smoked a grown man’s weight in tobacco.

Introduction | Demonstration Calculator | Source Code

Demonstration Calculator

Number of years you smoked:

Average number of cigarettes you smoked each day:

Average price for a pack of cigarettes in your area (in dollars)

Introduction | Demonstration Calculator | Source Code

Smoking Calculator Source Code

This calculator is licensed to you under Creative Commons Attribution 3.0. If you would like to use the source code on your site or create a derivative work from it, you must include the following HTML on the page where the calculator appears. We’re giving you this code for free with a legal license to use it. All you have to do is credit us in the manner we specify.

Required Credit HTML

INSTALLATION

Just cut and paste the Javascript code and HTML form below into your page. If you want to customize the appearance of the form, feel free. Just make sure the input name and form id/name values are not changed.



<script type="text/javascript">
function calcSmokes(){

// GET VALUES FROM FORM, SET VALUE TO ONE IF THE VALUE IN THE FORM IS NOT A NUMBER

var years = (isNaN(document.wcbubba.years.value)) ? 1 : document.wcbubba.years.value;
var smokes = (isNaN(document.wcbubba.smokes.value)) ? 1 : document.wcbubba.smokes.value;
var price = (isNaN(document.wcbubba.price.value)) ? 1 : document.wcbubba.price.value;

// DO CALCULATION OF NUMBER OF CIGARETTES SMOKED ROUNDED TO WHOLE NUMBER

var smoked = parseInt(years * 365.25 * smokes);

// CALCULATE TODAY'S VALUE OF ALL CIGS ROUNDED TO TWO DECIMAL PLACES

var expense = parseInt(((smoked/20) * price) *100) / 100;

// CALCULATE WEIGHT OF TOBACCO IN GRAMS AND POUNDS TO TWO DECIMAL PLACES

var weight = parseInt((smoked * 0.68) *100) / 100;
var pounds = parseInt(((weight/1000) * 2.204) * 100) / 100;

var expout = 'You smoked approximately ' + smoked + ' cigarettes.<br>At current prices, that would cost $' + expense + '.<br>And the weight of the tobacco in all those cigarettes was ' + pounds + ' pounds (' + weight +' grams).';

document.getElementById('totals').innerHTML = expout;
}
</script>

<form name="wcbubba" action="javascript:void();">
Number of years you smoked:<br>
<input type="text" size="5" name="years"><br><br>
Average number of cigarettes you smoked each day:<br>
<input type="text" size="5" name="smokes"><br><br>
Average price for a pack of cigarettes in your area (in dollars)<br>
<input type="text" size="5" name="price"><br><br>
<input type="submit" value="Show My Totals" onclick="calcSmokes()"></form><br>

<div id="totals"></div>

]]>
https://calculators-free.com/smoking-calculator-13/feed/ 0
Fun Google Compatibility Calculator https://calculators-free.com/fungoogle-compatibility-calculator-8 https://calculators-free.com/fungoogle-compatibility-calculator-8#respond Wed, 26 Dec 2018 04:19:34 +0000 https://calculators-free.com/?p=6 Introduction | Demonstration Calculator | Source Code

How The Google Compatibility Calculator Works

Enter your name and the name of the person you want to be matched with into the appropriate boxes in the calculator, then click “Calculate Our Compatibility”. A client-side JavaScript uses AJAX to query Google for the number of search results that come up for each name at Google. It then uses those numbers to determine a compatibility score.

Please note the calculator doesn’t work properly, since Google changed the API.

 

Introduction | Demonstration Calculator | Source Code

Demonstration Calculator

GOOGLE COMPATIBILITY CALCULATOR

 

Your Name:
Crush’s Name:

Introduction | Demonstration Calculator | Source Code

Fun Google Compatibility Calculator Source Code

 
This calculator is licensed to you under Creative Commons Attribution 3.0. If you would like to use the source code on your site or create a derivative work from it, you must include the following HTML on the page where the calculator appears. We’re giving you this code for free with a legal license to use it. All you have to do is credit us in the manner we specify.

Required Credit HTML

INSTALLATION

Download popucalc.zip. In it you will find the three graphics, PHP script for querying Google via their RESTful search API, an HTML file with the AJAX JavaScript and the search form, plus a README file with further instructions on getting it running.

Here are the two source files if you’d like to examine them.

JavaScript & HTML source code


<script type="text/javascript">

var firstval = "";
var secondval = "";
var firstdone = false;
var seconddone = false;
var offset=3;

function popucalc(){

document.getElementById('calcresults').innerHTML = '<b>Calculating</b><br /><img src="/images/pleasewait.gif">';

var firstname = escape(document.popcalc.firstname.value);
var getURL = 'popucalc.php?SP=' + firstname;
parseName(getURL,'first name');

var secondname = escape(document.popcalc.secondname.value);
getURL = 'popucalc.php?SP=' + secondname;
parseName(getURL,'second name');

}

function parseName(getURL,nameID)
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }

//this is the part that processes the incoming data
    xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        var myresults = xmlHttp.responseText; 
        parseResults(myresults,nameID);
      }
    }

//This is the part that sends it
  xmlHttp.open("get",getURL,true);
  xmlHttp.send(null);
  
  
  }
function parseResults(result,nameID){
  
    if(nameID == 'first name') {
       firstval = (isNaN(parseInt(result))) ? 0 : parseInt(result);
        firstdone = true;
       
          } else if (nameID == "second name"){
          secondval = (isNaN(parseInt(result))) ? 0 : parseInt(result);
          seconddone = true;
          }
 
     if((firstdone)&&(seconddone)) showresults(); 
 }
           
function showresults(){
     
     var topper;
     var bottomer;
     firstdone=false;
     seconddone=false;
     
     if(firstval > secondval){
          bottomer = firstval;
          topper = secondval;
          } else {
          topper = firstval;
          bottomer = secondval;
          }

     var popindex;
          
          if((topper == 0)||(bottomer==0)){
               popindex = 0;
               } else {
 
          var popindex = (topper/bottomer);
          popindex = Math.round(popindex*1000)/1000
               }
               
      var popcover = Math.round(200 - ((popindex * 190) + 10));
      var popamt = Math.round(popindex * 1000)/10;
      
     var resultspot = document.getElementById('calcresults');
     
     var resout = '<b>Matched: ' + popamt + '% </b><br>' + document.popcalc.firstname.value + ' and ' + document.popcalc.secondname.value + '<br>';
     
     resout += '<div style="width:210px;height:45px;padding:5px;border:1pt solid #222;font-size:12px;"><div style="width:100px;float:left;text-align:left">Cool</div><div style="width:100px;float:left;text-align:right">Scorching</div><br style="clear:all">';

     var quoter = "'/images/pcgradient.gif'";

     resout += '<div style="width:200px;height:20px;margin:0px;padding:0px; background:url('+quoter+');text-align:right;"><img src="/images/pcwhite.gif" height=20 width=' + popcover + ' style="margin:0px;padding:opx;border:none;" /></div></div><br /><br />';
     
     resultspot.innerHTML = resout;

   }
  
  
</script>

<div style="border:2px solid #222;margin:5px;padding:5px;width:350px;"><h3>GOOGLE COMPATIBILITY CALCULATOR</H3>
<form name="popcalc" action="javascript:void();">
Your Name: <input size=20 name="firstname" id="firstname" type=text> <br>
Crush's Name: <input size=20 name="secondname" id="secondname" type=text><br>
<input type="submit" value="Calculate Our Compatibility" onClick="popucalc()";>
</form>
<div id="calcresults" style="height:120px;"></div><br />
</div>

 

PHP source code


<?php

$searchphrase = $_REQUEST["SP"];

$searchphrase = str_replace(""","",$searchphrase);
$searchphrase = str_replace("%22","",$searchphrase);

$searchphrase=urlencode($searchphrase);

$booboo = passnum($searchphrase);

echo $booboo;

function passnum($searchphrase){

$url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=%22" . $searchphrase . "%22";

// sendRequest
// note how referer is set manually
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_REFERER, "http://www.mysite.com/index.html");
$body = curl_exec($ch);
curl_close($ch);

// now, process the JSON string
$json = json_decode($body, true);
// now have some fun with the results...

$sam = $json["responseData"]["cursor"]["estimatedResultCount"];

return $sam;
}

?>
]]>
https://calculators-free.com/fungoogle-compatibility-calculator-8/feed/ 0