Package java.math contains a class BigDecimal, used to represent an arbitrary-precision decimal number. Read the documentation for BigDecimal and answer the following questions:
a. Is BigDecimal an immutable class? b. If bd1.equals(bd2) is true, what is bd1.compareTo(bd2)?
c. If bd1.compareTo(bd2) is 0, when is bd1.equals(bd2) false?
d. If bd1 represents 1.0 and bd2 represents 5.0, by default what is bd1.divide(bd2)?
e. If bd1 represents 1.0 and bd2 represents 3.0, by default what is bd1.divide(bd2) ?
f. What is MathContext.DECIMAL128?
g. Modify the BigRational class to store a MathContext that can be initialized from an additional BigRational constructor (or which defaults to MathContext.UNLIMITED). Then add a toBigDecimal method to the BigRational class.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here