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);
}

Search CFLib.org


Latest Additions

Raymond Camden added
QueryDeleteRows
November 04, 2017

Leigh added
nullPad
May 11, 2016

Raymond Camden added
stripHTML
May 10, 2016

Kevin Cotton added
date2ExcelDate
May 05, 2016

Raymond Camden added
CapFirst
April 25, 2016

Created by Raymond Camden / Design by Justin Johnson