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...


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.

Nov 20, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here