Best method to round up to the nearest 0.05 in java

前端 未结 3 461
太阳男子
太阳男子 2020-12-06 19:42

Consider that a tax of 10% is applicable on all items except food. Also, an additional tax of of 5 % is applicable on imported items.

If the cost of a music CD is

3条回答
  •  误落风尘
    2020-12-06 20:10

    Store monetary amounts as integers (e.g. a number of cents).

    This is a common issue - google will give you plenty of great explanations.

    Here is one: Why not use Double or Float to represent currency?

提交回复
热议问题