N/APosted on - 10/27/2012
What is the best java script for calculating prices? I am creating a store system using java programming language and needs to get the proper algorithm on calculating prices that has been added to the customer’s cart. Can you give me a some code illustration and I will just edit it as a reference?
What is the best java script for calculating prices?
Calculation algorithm may vary according to your needs. Consider a below kind of a algorithm
for(int i = 0; i < Itemprice.length; i++)
FinalCustomerPrice= FinalCustomerPrice +(( Itemprice[i] + Tax+ OtherCharges) – Discount)
Store the prices of several items in a array which the customer has selected. Do the other reductions and additions to the original price and finally loop through the array to calculate the final value. You may modify the algorithm according to your needs.