SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    turning equation into javascript

    hello everybody, i was wondering if you could turn a body fat equation like the ones below into a working javascript calculator. It should have input fields for age, height (in cm) and the sum of 4 measured skinfolds (in mm).

    Here's the equation:

    for men %BF = 20.94878 + (age x 0.1166) - (height x 0.11666) + (sum4 x 0.42696) - (sum4˛ x 0.00159)

    for women %BF = 22.18945 + (age x 0.06368) + (BMI x 0.60404) - (height x 0.14520) + (sum4 x 0.30919) - (sum4˛ x 0.00099562)

    the formula for the BMI is weight / (height˛)

    thanks in advance...

  2. #2
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this is a typical type of exercise someone could expect to get in Javascript 101.

    It's relatively simple and straight forward. Post the html and javascript code you have so far so we can try to help.

  3. #3
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Kalon, i'm totally unaware of javascript. The attached files are from an existing Jackson/Pollock BF calculator that a friend of mine wrote with my help.

    It would be nice if the inch/cm (for height) and pound/kg (for weight) conversion option could be maintained. Like wise for the female/male option.

    An import part of the calculation are the rotating skin fold measurements. The same skin fold site should be measured at least twice. If both are within 2 mm the average is calculated, if not a third time should be measured and the two closest values are averaged.

    That's why there are 3 input slots (and a 4th with average) for each skf site.

    The measured skf sites are triceps, subscapular, supriliac and midthigh (sum4).

    I've attached 3 files: html, a global js and the actual js

    Let me know if something comes up.

    thanks for your quick response...
    Attached Files Attached Files

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Reding View Post
    Kalon, i'm totally unaware of javascript
    As it seems that you are proposing some kind of business arrangement, where someone else creates a solution to meet your business needs, I suggest that you go check out the Marketplace instead.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is not for a business. I'd want to test/extend its validity with a specific group of people and would be just as happy if it was available on an excel sheet. Any volunteers interested are more than welcome. If necessary i'll ask written permission of Dan Peterson, the friend who wrote the reference script. He's at the moment too occupied to do it himself.

    The equations were tested on a limited research group of caucasian men and women between the age of 18 - 55.

    If not possible i'll look elsewhere ... thanks for your time.

  6. #6
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Reding View Post
    If not possible i'll look elsewhere ... thanks for your time.
    As I said earlier, what you want to do is fairly simple and straight forward to do in javascript - or even Excel as you suggested.

    But it appears from your post you are not willing to learn how to do it, at least in javascript, and simply want someone to write the code for you free of charge.

  7. #7
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    how much would it cost on average? I don't see how and where i can learn something that complex in a short time.

  8. #8
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you're willing to pay someone to do it for you, have a look at the link posted by pmw57

  9. #9
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks, this sure isn't the most friendly forum

  10. #10
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Reding View Post
    thanks, this sure isn't the most friendly forum
    The work that you're wanting to be done could be a day or two of full-time work, perhaps longer depending on what extra things you require which you don't know of yet, until you see it in action.

    We are very happy to help people when they are learning or having trouble with their scripts, but to ask us to do that work for you free, is just asking too much.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  11. #11
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i've asked how much it would cost on average and suggested where or how i could learn scripting, enough said. There's no need to elaborate on previous assumptions that i wasn't prepared to pay ok?

  12. #12
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by Reding View Post
    There's no need to elaborate on previous assumptions that i wasn't prepared to pay ok?
    Okay. Not hard feelings here. I wish you all the best and hope that you find all of what you're looking for.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  13. #13
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Reding View Post
    i've asked how much it would cost on average and suggested where or how i could learn scripting, enough said. There's no need to elaborate on previous assumptions that i wasn't prepared to pay ok?
    Assuming you have posted all your requirements and there won't be any last minute changes/additions then to build a user input form and the javascript to do the calculations and display the results should take no more than 1-2 hours tops, including testing, if you would be happy with a plain vanilla, no frills or jazzy colours layout/design.

    How much would that cost on average?

    That depends on what part of the world you are in and what the going rate is for website development in your area. This is a global website and we could be 180 meridians of longitude apart. It also depends on whether you go to an established medium to large website development company (with larger overheads) or to a one-man-band like myself with virtually no overheads that does everything - well almost everything .


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •