Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your BigDecimal class should have the following constructors BigDecimal ( ) - default constructor should simply set your container to three Char objects that contain

Your BigDecimal class should have the following constructors
BigDecimal()- default constructor should simply set your container to three Char objects that contain the values '0''.''0'
BigDecimal(String value)- This constructor will parse the string taking each digit, putting it into a new Char and adding the Char to the container.
Your BigDecimal class should also contain the following mutators
void setValue(char ch)- A char that contains a digit
void setValue(String value)- This does the same as the overloaded constructor that takes a string
BigDecimal add(BigDecimal)- Adds the values together and returns the result as a Big Decimal
BigDecimal sub(BigDecimal)- Subtracts the two values and returns the result as a BigDecimal
Note: If you are using C++ feel free to use the + operator instead of the add function.
I am going to let you off the hook for the multiply and divide but it should be easy to implement.
Accessors
double toDouble()- Returns the value stored in the container as a double
String toString()- Returns the value store in the container as a string
Char at(int index )- Returns the value at the particular index as a Char
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions

Question

Recognize the four core purposes service environments fulfill.

Answered: 1 week ago