CFLib.org – Common Function Library Project

WeightWatchersPoints(calories, fat, fiber)

Last updated January 16, 2002

author

William Steiner

Version: 1 | Requires: CF5 | Library: MathLib

Description:
Function takes calories, fat grams, and grams of dierary fiber and returns the number of Weight Watchers Winning Points.

Return Values:
Returns a number.

Example:

<CFSET Cal=400>
<CFSET Fat=3>
<CFSET Fiber=1>

<CFOUTPUT>
A meal containing #Cal# calories, #Fat# gram(s) of fat, and #Fiber# gram(s) of fiber equals #WeightWatchersPoints(Cal,Fat,Fiber)# point(s).
</CFOUTPUT>

Parameters:

Name Description Required
calories Total number of calories (kcal) . Yes
fat Total number of fat grams. Yes
fiber Total grams of fiber. Yes

Full UDF Source:

/**
 * Returns Weight Watchers Winning Points from calories, fat, and dietary fiber.
 * 
 * @param calories 	 Total number of calories (kcal) . 
 * @param fat 	 Total number of fat grams. 
 * @param fiber 	 Total grams of fiber. 
 * @return Returns a number. 
 * @author William Steiner (williams@hkusa.com) 
 * @version 1, January 16, 2002 
 */
function WeightWatchersPoints(calories,fat,fiber) {
  if (fiber gte 4)
    fiber = 4;
  return Int((calories - (fiber * 10) ) / 50 + fat / 12 + 0.5);
}
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Kevin Cotton added
date2ExcelDate
May 5, 2016

Raymond Camden added
CapFirst
April 25, 2016

Chris Wigginton added
loremIpsum
January 18, 2016

Gary Stanton added
calculateArrival...
November 19, 2015

Sebastiaan Naafs - van Dijk added
getDaysInQuarter
November 13, 2015

Created by Raymond Camden / Design by Justin Johnson