What is the best java script for calculating prices?

Asked By 10 points N/A Posted on -
qa-featured

Hello experts,

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?

SHARE
Answered By 0 points N/A #131227

What is the best java script for calculating prices?

qa-featured

 

Calculation algorithm may vary according to your needs. Consider a below kind of a algorithm

Double[] Itemprice={Price};

Double Tax;

Double OtherCharges;

Double Discount;

Double FinalCustomerPrice=0;

for(int i = 0; i < Itemprice.length; i++)

 {

          FinalCustomerPrice= FinalCustomerPrice +(( Itemprice[i] + Tax+ OtherCharges) – Discount) 

 }

 

return FinalCustomerPrice

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.

Login/Register to Answer

Related Questions