| myslf (15) | |
|
A: CREATE A CLASS TO CONVERT FROM ANY NUMBER BASE TO ANOTHER (FOR Example: from DECIMAL to BINARY) CLASS SHOULD - have only one private long integer variable - contain overloaded constructors as follows * className() (DEFAULT CONSTRUCTOR - creates an object with default integer value of zero) * className( int x ) (CONSTRUCTOR - creates an object with default integer value of x in decimal base) * className( char x, char c) (CONSTRUCTOR - creates object with integer convert to decimal from base c) - have a public member function get_value() such that * get_value() - returns the decimal value of integer variable * get_value( char c ) - returns the base c value of decimal integer variable * get_value( int x, int y) - returns the list of base values between the base x and base y for the integer variable - x and y must be greater than zero AND y must be greater or equal to x - create the conversion functions as you see fit (public or private - utility function) | |
|
Last edited on
|
|
| Zhuge (2871) | |
| Something you don't understand about your assignment? | |
|
|
|
| myslf (15) | |
| how to create class with this information? | |
|
|
|
| Script Coder (352) | |||
One piece of advice I can give. If converting from larger base to smaller base, you can divide the number by the smaller base and read the remainders in reverse order:
When converting from smaller to larger base:
You might find it easier to first convert to base 10, than dividing in other bases. | |||
|
|
|||
| myslf (15) | |
| i know all these even i have program without using class all i don't how to do this program with the class.. :( | |
|
|
|