# Thread: turning equation into javascript

1. ## 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˛)

2. 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. 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.

4. Originally Posted by Reding
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.

5. 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. Originally Posted by Reding
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. 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. if you're willing to pay someone to do it for you, have a look at the link posted by pmw57

9. thanks, this sure isn't the most friendly forum

10. Originally Posted by Reding
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.

11. 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. Originally Posted by Reding
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.

13. Originally Posted by Reding
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 .

#### Posting Permissions

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