I am to write a program that converts either binary, hex or octal to decimal. We are to use methods for the first time (Not a problem). I have written almost all of the code but the conversion. We can't use int.toDecimal or any shortcut. All must be long coded so that we learn something from the process.

I have looked for the past 3 days trying to find the answer to how this should be accomplished and have found nothing.

My question is how to take an input of either an integer or string and output it in one of the three. I know the formulas but I cannot figure out how to turn them into a working code. For instance: octal to decimal would ask for the number to be counted and then the powers of 8 adjusted accordingly: number = 765 so (7x8^2)+(6x8^1)+(5x8^0)

then it would be added and output in decimal form.

I need to figure out how to do this sort of thing with each and account for either input of any number be it hex or binary. Any help would be greatly appreciated.

Thanks in advance,

24x24