0

I wanted to create this program which lets the user choose from the 4 number systems, binary,decimal,hexadecimal, and octal. inputs a number for the chosen number system, then converts it to the other three number systems. Help anyone?

5
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by josephbeluan
0

Use class java.lang.Integer. There are 3 static methods with radix word. (radix can be [2,...,36])
...or better yet, write a program that reflects the manual methods carried out on paper.

Edited by quuba: n/a

0

Im like at 0.1 knowledge on java ^_^. And im not allowed to use packages for that matter. I need to do the syntax like completely, and to be honest I dont know how T_T

0

why don't you give it a try.
I promise I'll help you out, but I want to see you trying to write some code on your own first ;)

0

here is some help for u :

decimal to binary :

while(n!=0)
{
a[x++]=n%2;
n/=2;
}
x--;
while(x>=0)
System.out.println(a[x--]);

Octal to decimal us % and / by 8 insted of 2 and for hexadecimal use % and / by 16.
take care while printing hexadecimal output as it have 0-9 and A-F.

gud luck

0

ok thanks, im working on it now, i got binary to octal, and decimal but not hexadecimal yet. And decimal to all three, ill post program when im kinda done with it. but thanks for the help ^_^

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.