Consider the following problem:
Ram goes to the auto parts store to buy a spark plug that costs $1.10, but all he has in his wallet are two-dollar bills. How much change should he get if he pays for the spark plug with a two-dollar bill?
Here is a problem that attempts to solve the word problem. What does it print?
CODE:
public class Change
{
public static void main(String args[])
{
System.out.println(2.00-1.10);
}
}
Output:
0.8999999999999999
Here is a concept of BigDecimal :
Ram goes to the auto parts store to buy a spark plug that costs $1.10, but all he has in his wallet are two-dollar bills. How much change should he get if he pays for the spark plug with a two-dollar bill?
Here is a problem that attempts to solve the word problem. What does it print?
CODE:
public class Change
{
public static void main(String args[])
{
System.out.println(2.00-1.10);
}
}
Output:
0.8999999999999999
Here is a concept of BigDecimal :