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?
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?
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.
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
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 ;)
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
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 ^_^
no code?