Hey all
I got less than 3 hours to get this sorted >.<!!
I need to be able to calculate this in javascript and its going to require some maths formula I can't seam to land on no matter how many times I play around with it.
Its to work out a parcel price
and this parts based on weight
Less than 500g's is £1.65, Done
Less than 1kg is £3.00, Done
When above 1kg, £1 for each additional 500g!
I have been trying 3 different codes, my last one is the closest, but I been tweaking it loads, and can't get it to land on correct answer.
Valu3 = weight
price = output
I hope someone's really good at maths that they can work out figures to be able to calculate the price depending on this sort of stuff.
Thanks in advance
I got less than 3 hours to get this sorted >.<!!
I need to be able to calculate this in javascript and its going to require some maths formula I can't seam to land on no matter how many times I play around with it.
Its to work out a parcel price
and this parts based on weight
Less than 500g's is £1.65, Done
Less than 1kg is £3.00, Done
When above 1kg, £1 for each additional 500g!
I have been trying 3 different codes, my last one is the closest, but I been tweaking it loads, and can't get it to land on correct answer.
Code:
/*if (valu3>999)
{price=3;
valu3-1000;
valu3/500;}*/
/*
if (valu3>999)
{price=valu3+499/500}*/
if (valu3>999)
{price=valu3-1000/500}
alert(price);}
Valu3 = weight
price = output
I hope someone's really good at maths that they can work out figures to be able to calculate the price depending on this sort of stuff.
Thanks in advance