Rewrite Listing 2.10, ComputeChange. java, to fix the possible loss of accuracy when converting a float value

Question:

Rewrite Listing 2.10, ComputeChange. java, to fix the possible loss of accuracy when converting a float value to an int value. Read the input as a string such as "11.56". Your program should extract the dollar amount before the decimal point and the cents after the decimal amount using the indexOf and substring methods.

Listing 2.10

image

image

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: