I have to perform operation on Money(basically dollars). I have to get the price of a product then multiply with the Quantity and in a same way do the transactions.
Currently i am using the double and at some places float to perform operations on amount. They give me output like 13.789689 but i need only up to 2 digits. So that i have applied
String value = String.format(Locale.ENGLISH, "%.2f", 13.789689);
to get that upto 2 digits. But now the problem is results are not coming accurate. Also i am to saving the Transactions information into the database and that shows variations in Cash and CC trans. I am So frustrated by this because it's operation with money and i am loosing that. Please guide me what to best in that case.