Due date Sep. 22, 2003
The purpose of this assignment is to write a class that can be used to convert
numbers from their base 10 representation to a different base B, which for
convenience we assume to be smaller than 10.
In any base B, we use digits from 0 to B-1. The least significant digit (the
ightmost one) is the remainder of dividing the number by B. Positional notation
means that the second position from the right is in units of B, third position
in units of B*B, etc. So all digits (computed right to left) are obtained by
successive divisions and remainder operations.
Your program should take two inputs: a number N of up to 7 digits, and a
and a digit B greater than 1. The output of the program is the representation
of N in base B. For example:
java toBase 35 2
The number 35 in base 2 is written 100011
java toBase 49 8
The number 49 in base 8 is written 61
You should not use any built-in classes or methods, except Parseint. To
construct the result digit by digit, use an array of characters, and display
its contents at the end.