# Online quote scipt

• November 25th, 2013, 01:40 PM
MBCUK
Online quote scipt
I am trying to build or find an on-line instant quote calculator

the formula I am trying to calculate is

£49 for the first 35 items

£0.85 each item thereafter

user inputs total amount of items eg 400 items

400 items - 35 = 365

365 * 0.85 = 310.25

310.25 + 49 = 359.25

Total Price £359.25

Then the total price £359.25 / 400 to give the price per item £0.89 (to two decimal places)

I've found several on-line calculator builders but nothing that can handle this sort of variables.

This script is the closest I have got but my maths is terrible and I cant seem to edit the code correctly http://www.dynamicdrive.com/forums/s...ote-calculator
• November 25th, 2013, 01:43 PM
MBCUK
Re: Online quote scipt
just for the record.. I am here to learn.. please just push me in the right direction, not asking for the solution here.. (just experienced abuse on stackoverflow lol)

everyones thinks it... noobs! who'd have em'
• November 25th, 2013, 01:48 PM
MBCUK
Re: Online quote scipt
I have this as a starting point

Math.round(400*(49+Math.max(count-35;0)*0.85)/count)/400
• November 30th, 2013, 04:53 PM
PeejAvery
Re: Online quote scipt
You already have the math completely done in the first post. All you have to do is get the input now.

```var minimum = 35,     output = 0,     input  = prompt("How many items?"); if ( input<=minimum ) {     output = 49;  // first 35 items are minimum £49 } else {     output  = input - minimum;     output  = output * 0.85;  // 85p per additional item above minimum order     output += 49; } alert("Total = £"+output.toFixed(2)+", Per Item = £"+(output/input).toFixed(2));```