boolean method named checker that accepts two double and one int formal pa- rameters

boolean method named checker that accepts two double and one int formal pa-
rameters. The purpose of this method is to compare the first two parameters by matching

the first several positions after the decimal point. The number of comparisons is given by
the third parameter.

(a) Remove the whole number portion from both of the double parameters by sub-
tracting the integer-casted values, e.g., 1.5 will become:

1.5 – (int)(1.5) = 1.5 – 1 = 0.5
(b) Convert both double values to String representations with calls to the static
method Double.toString(double).

(c) Remove the leading zero (0) and decimal point (.) from both String represen-
tations with calls to the String class method substring(int), which returns a

String. The parameter sent to substring(int) will be 2 since the new String
will start at index 2 of the initial String representation.
(d) Compute the minimum of the two String lengths. Determine if minimum is less
than the value sent as the third parameter. If so, return false since the provided
numbers do not have sufficient values after the decimal point.

(e) Compare the two Strings character-by-character. All comparisons from the be-
ginning of the Strings onward must succeed, up to the number of comparisons

given by the third parameter. Return true when all comparisons succeed, false
otherwise

Complete Answer:

Get Instant Help in Homework Asap
Get Instant Help in Homework Asap
Calculate your paper price
Pages (550 words)
Approximate price: -
Open chat
1
Hello 👋
Thank you for choosing our assignment help service!
How can I help you?