PDA

EBITON5
01-02-2014, 11:41 PM
Hi ,

I whoul like to change the precent from *1.17 (17%) to calc of precent like this :

3% + 5% + 5\$ = Result

For example :

The resault is 10\$ - i want to write in code instead *1.17 :

10\$ +3%(0.3\$) + 0.5% (0.51\$) + 5\$ = 15.81\$

How i change this line to this calc

if(results[i].getSite()=='Xxx'&&XPrice==0)
{
XPrice =(results[i].getPrice() *1.17);
}
}

Thank you so much !

jscheuer1
01-03-2014, 02:09 AM
*1.17

is 117 percent of.

The % symbol in javascript means modulo (remainder after division by a number). If you don't want a modulo, don't use it. For percent, multiply by the decimal.

Nile
01-03-2014, 02:15 AM
This question is extremely unclear. At first, I was preparing myself to look up some Java syntax. Before anyone can begin answering this question, you need to restate it in a way that makes it comprehensible and valid (grammatically and logically). Provide us with a few input/output fields so we know what you're talking about and specify exactly what you want.

@John Maybe he's trying to add 17%?

traq
01-03-2014, 07:36 AM
@John Maybe he's trying to add 17%?
I think John hit it: the code works as desired but the OP doesn't like the syntax (he wants to specify the percentages with a % sign, which, as John points out, does something else entirely).

Nile
01-03-2014, 01:56 PM
OP:

price * 1.08 + 5; //Multiply the code by 100% + 5% + 3% (1.08), then add 5