Chrisschristou, ask yourself a few questions :
- Why calculate
grandtotal
but not use it? - Why is
grandtotal = parseFloat(totalofptotal + shippingtotal)
inside the loop? - Should there be a
shippingtotal += ...
statement? - Is the expression
shippingtotal = parseFloat(shipping * wholeqtty)
correct? Is shipping proportional to quantity? It may be, but typically it doesn't cost twice as much to ship two items to the same address. Most shipping companies charge by weight or "volumetric weight". grandtotal = parsefloat(...)
andshippingtotal = parsefloat(...)
- Whyparsefloat()
values that are already numbers?parsefloat()
is only necessary to convert a string representation of a number to Number.