decimal to binary converter - java

S

sam20e

hi i need a help... i wanna write a java programmee to display the
binary number of the entered decimal number.

for ex : in t text area u should type a desimal number and press
"Convert" button to display its binary in the next txt field

need help mates, i need to write a programme.. i need the "JAVA CODES"

p.s : should use only 1 statement; stack
 
J

John W. Kennedy

sam20e said:
hi i need a help... i wanna write a java programmee to display the
binary number of the entered decimal number.

for ex : in t text area u should type a desimal number and press
"Convert" button to display its binary in the next txt field

need help mates, i need to write a programme.. i need the "JAVA CODES"

p.s : should use only 1 statement; stack

Do your homework yourself. If, after having made a reasonable effort,
you find yourself stuck, come back.
 
S

Sideswipe

Although he should be doing his homework himself, this is a simple
implementation trick. I would prefer he not be discouraged by
newsgroup trolls and focus his emphasis in learning on design. After
all, what I am about to show him he could eventually find, but no
amount of documentation is going to get him to design good code.

Integer.toString(input,2); // just 1 example

Please see all the "toString" methods of Integer. There are several
ways to do it right there.

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Integer.html

Christian Bongiorno

http://christian.bongiorno.org
 
K

~kurt

Sideswipe said:
Although he should be doing his homework himself, this is a simple
implementation trick. I would prefer he not be discouraged by

What, are you one of those bleeding hearts who is in the process of
destroying our educational system by doing everything that can be done
to protect our children's fragile egos? Boo hoo hoo....
newsgroup trolls and focus his emphasis in learning on design. After

Design is part of writing software - knowing the details can affect
design. Going through the exercise of figuring out this problem
is more important - he'll get pleny of opportunities to learn design.
all, what I am about to show him he could eventually find, but no

So, he could have learned how to find things instead? What is that
saying about giving a man a fish vs. teaching a man how to fish?
All you are teaching him is to go to Usenet for all his thinking.
amount of documentation is going to get him to design good code.

This probably wasn't a design class. It looked like a classic hw problem
to me.

- Kurt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,277
Latest member
VytoKetoReview

Latest Threads

Top