Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PFT Calculations

Status
Not open for further replies.

killer23

IS-IT--Management
Joined
Jan 4, 2001
Messages
22
Location
US
I am creating a database to track my Marines. Part of this tracking is calculating something called PFT scores (pysical fitness test). I have found code in java that will do the calculations for me, but I need the same functionality with in a Access DBase; the code is as follows -

// Calculate score for crunches for either sex (same standards)
function calcCurl(Curl) {
if (Curl < 40)
return(-1);
else if (Curl > 100)
Curl = 100;

return(Curl);
}

//*************************************************************
// Calculate pull-ups score for Males
// June/July 1998 Standards, same as 25 June 1996 Standards
function calcPull_M(Pull) {
if (Pull < 3)
return(-1);
if (Pull > 20)
Pull = 20;

return(5*Pull);
}

//*************************************************************
// Calculate Flexed arm Hang score for Females
function calcHang_F(Time) {

if (Time < 15)
return (-1);
if (Time <= 40 && Time >= 15)
return (Time);
else if (Time > 40 && Time <= 70)
return (40 + (2*(Time - 40)));
else if (Time > 70)
return (100);
return (40 + (2*(Time - 40)));
}

//*************************************************************
// Calculate score for run for Males

function calcRun_M(Run_m, Run_s) {
var seconds = (60*Run_m)+1*Run_s;
var mod = seconds%10;
if (mod == 0)
mod = 10;
seconds = (10 - mod) + seconds;
if (seconds > 1680)
return (-1);
else if (seconds <= 1080)
return(100);
else if (seconds > 1080 && seconds <= 1680)
return (100 - (seconds - 1080)/10);
}

//*************************************************************
// Calculate score for run for Females
// June/July 1998 Standards, changed from 25 June 1996 Standards
function calcRun_F(Run_m, Run_s) {
var seconds = (60*Run_m)+1*Run_s;
var mod = seconds%10;
if (mod == 0)
mod = 10;
seconds = (10 - mod) + seconds;
if (seconds > 1860)
return (-1);
else if (seconds <= 1260)
return(100);
else if (seconds > 1260 && seconds <= 1860)
return (100 - (seconds - 1260)/10);
}

//*************************************************************
// Decide which run fxns to call
function calcRun(Sex, Run_m, Run_s) {
if (Sex == 1)
return(calcRun_M(Run_m, Run_s));
else
return(calcRun_F(Run_m, Run_s));
}

//*************************************************************
// Decide which pull fxns to call
function calcPull(Sex, Pull) {
if (Sex == 1)
return(calcPull_M(Pull));
else
return(calcHang_F(Pull));
}

//*************************************************************


// Main calculation function
function calcScore (Sex, Pull, Curl, Run_min, Run_sec) {
var Pull_prcent, Run_prcent, Curl_prcent;
if (Pull == &quot;&quot;)
Pull = 0;
if (Curl == &quot;&quot;)
Curl = 0;
if (Run_min == &quot;&quot;)
Run_min = 30;
if (Run_sec == &quot;&quot;)
Run_sec = 0;

Run_prcent = calcRun(Sex, Run_min, Run_sec);
Curl_prcent = calcCurl(Curl);
Pull_prcent = calcPull(Sex, Pull);


if(Pull_prcent == -1 || Run_prcent == -1 || Curl_prcent == -1)
return (0);
var total = 1*Run_prcent + 1*Pull_prcent + 1*Curl_prcent;
if (total < 135)
total = 0;
return(total);
}

Any help that anyone can give me would be GREATLY appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top