i kinda need help here. I've got this project where I can use any language of programming. The program is called number system converter. It's like converting binary to decimal or vice versa. The code would be straight forward as possible, nothing too fancy.
languages that can be used:
C (third preffered)
java (second preferred)
visual basic (preferred language to be used)
assembly (least language to be used)
GUI:
1) either the user will input using the keyboard or by just clicking on the interface
2) radio buttons
limits of characters that can be inputted:
binary: 8 characters (max: 11111111 or 01010101)
decimal: 3 characters (max: 255)
octal: 3 characters (max: 377)
hexadecimal: 2 characters (max: FF)
it goes like this:
when the program is used the user is shown 4 options: binary, decimal, octal, and hexadecimal then after the choice the user gets prompted to enter the number/letter of his choice (maybe 1111 if he chose binary or A if he chose hexadecimal). then after pressing ok, another prompt will pop out telling the user how will it be done, convert it to: binary, decimal, octal, hexadecimal, and convert to all (if the user chose binary in the input stage so in the conversion stage the binary option will be faded). Then after pressing the designated choice, the result pops out.
please, i really need it. thanks so much in advance. i'll entertain questions/clarifications anytime.
number system converter
Started by hawil, Dec 10 2009 02:45 AM
36 replies to this topic
#1
Posted 10 December 2009 - 02:45 AM
|
|
|
#2
Posted 10 December 2009 - 02:53 AM
what language of those is your preferred? what do you have best knowledge in?
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#3
Posted 10 December 2009 - 04:04 AM
So, do you want anyone make code for you, or let you know how to do on some main points?
Regard.
Cholnam, Kim./
Regard.
Cholnam, Kim./
#4
Posted 10 December 2009 - 06:48 AM
i just started studying java.. a little bit og C but not enough for that kind of programming.
i would really prefer VB for the program and maybe java but VB as priority.
as much as i don't want it but (due to lack of knowledge of programming) i'm seeking for someone to make the program for me.
i would really prefer VB for the program and maybe java but VB as priority.
as much as i don't want it but (due to lack of knowledge of programming) i'm seeking for someone to make the program for me.
#5
Posted 10 December 2009 - 08:06 AM
Do you need help with the conversion algorithm, or something else?
#6
Posted 11 December 2009 - 01:07 AM
yes conversion algorithm or somewhat the whole code of the program. i really don't have any idea about this problem.:confused:
#7
Posted 11 December 2009 - 04:52 AM
Hello,
I can give you some hints. First I will show you how convert number from any numeral system to decimal system...
Take for example binary number 101101. First digit from right is count of ones, second is count of 2, then 4, 8, 16...2^n (base of power is 2, because we are in binary system). So number 101101 is in decimal 1*1 + 0*2 + 1*4 + 1*8 + 0*16 + 1*32=45.
If we had number in ternary numeral system, for example 2102, in decimal it would be 2*1 + 0*3 + 1*9 + 2*27 (digits are counts of 1, 3, 9, 27, 81...3^n).
And now conversion from decimal system to any other. We will repeatly divide our number by base of numeral system, to which we want to convert it. Say that we have number 14 and we want convert it to ternary system:
14/3=4 (take answer and divide it again)
2 (modulo)
4/3=1
1
1/3=0 (0 means, that is it end of algorithm)
1
Now take modulos from bottom to top and you have answer = 112.
In language C, there is useful function itoa(int value, char * str, int base), which will convert number to string for given base of numeral system.
...I hope you will decode me poor english :)
I can give you some hints. First I will show you how convert number from any numeral system to decimal system...
Take for example binary number 101101. First digit from right is count of ones, second is count of 2, then 4, 8, 16...2^n (base of power is 2, because we are in binary system). So number 101101 is in decimal 1*1 + 0*2 + 1*4 + 1*8 + 0*16 + 1*32=45.
If we had number in ternary numeral system, for example 2102, in decimal it would be 2*1 + 0*3 + 1*9 + 2*27 (digits are counts of 1, 3, 9, 27, 81...3^n).
And now conversion from decimal system to any other. We will repeatly divide our number by base of numeral system, to which we want to convert it. Say that we have number 14 and we want convert it to ternary system:
14/3=4 (take answer and divide it again)
2 (modulo)
4/3=1
1
1/3=0 (0 means, that is it end of algorithm)
1
Now take modulos from bottom to top and you have answer = 112.
In language C, there is useful function itoa(int value, char * str, int base), which will convert number to string for given base of numeral system.
...I hope you will decode me poor english :)
#8
Posted 11 December 2009 - 05:22 AM
wow, thanks for some ideas but i'm having problems in 'decoding' meaning i don't know what codes to right. i'll be using vb. please help. i'm grinding my teeth on how to do this.
#9
Posted 11 December 2009 - 07:52 AM
Here are two sites that have the logic in JavaScript. If you view source, you should be able to figure out how they work:
Base Conversion
Binary, Ternary, Octal, Duodecimal, Hexadecimal Systems, Base Convertion from Interactive Mathematics Miscellany and Puzzles
Base Conversion
Binary, Ternary, Octal, Duodecimal, Hexadecimal Systems, Base Convertion from Interactive Mathematics Miscellany and Puzzles
#10
Posted 12 December 2009 - 04:18 AM
wow. thanks for the info. now, my problem is how to start the program specially with the design. can someone shed me some light here?
#11
Posted 12 December 2009 - 05:18 AM
Have you settled on a language yet?
#12
Posted 12 December 2009 - 05:46 AM
i thought of VB as what i've heard that language is easier to use specially a program with a GUI.


Sign In
Create Account


Back to top









