Exercises - 3

http://www.teaching-materials.org/javascript/exercises/functions.html

by webspicer

JavaScript

function calculateSupply(userAge, userAmtDay, maxAge)
{
	var totalNeed = ((userAmtDay * 365) * (maxAge - userAge));
  alert("You will need "+ totalNeed +" to last you until the ripe old age of "++maxAge);
}

calculateSupply(28, 36, 100);
calculateSupply(28, 2.5, 100);
calculateSupply(28, 400, 100);