Adding VAT to a variable (MATH equation)
Hi guys,
Just a quick one. I need to add VAT (tax) to the price scrape of a new taks. Excuse my ignorance. Here's what i ahvew, however my value is not an integer -
if (session.getVariable("price") != null)
{
numA = Integer.parseInt(session.getVariable("price")).intValue();
numB = Integer.parseInt("1.15").intValue();
session.setVariable("priceincVAT",(NumA * NumB));
}
I get an error as i need to set the variable as a float, but i don't know how to do that.
Here's a function I use to
Here's a function I use to take a scraped value and parse to a Float:
makeNum(number)
{
if (number!=null)
{
number = number.replaceAll("[\\D\\.]","");
if (number.length()>0)
{
number = Float.parseFloat(number);
}
else
{
number = 0;
}
}
else
{
number = 0;
}
return number;
}
price = makeNum(dataRecord.get("PRICE"));