aspose file tools*
The moose likes Beginning Java and the fly likes please help meeeee Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "please help meeeee" Watch "please help meeeee" New topic
Author

please help meeeee

Burak Tass
Greenhorn

Joined: Jun 24, 2009
Posts: 12
2. Write a Java program that will reverse any input integer number. For example, if the user enters 1439, your program must find 9341, or if -628 entered, -826 must be cretaed (the output must also be an integer).
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I'm sorry Burak, but we try not supply direct answers to assignment/interview questions or provide ready made code samples (please, have a read of this).

We will however help you work through the coding problems you are having. So, what have you tried? Can you post the code you've got so far? Or if you've got nothing, can you explain what is confusing you?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Burak Tass
Greenhorn

Joined: Jun 24, 2009
Posts: 12
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

...and what seems to be going wrong? What issues are you having?
Burak Tass
Greenhorn

Joined: Jun 24, 2009
Posts: 12
But we should't use boolean without boolean how can do this and i have to do this with output i have to give numbers and it should be reversed this numbers not Strings
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11311
    
  16

So.. does that code compile? does it run? does it die? does it give you the wrong output? What were you expecting, what did it give you?

folks here will BEND OVER BACKWARDS to help you - but you have to make it easy for them. Everyone volunteers their time, and the harder it is for them to help you, the less likely they are to help.

Just a friendly tip!

also, you should learn to use the code tags. click that 'code' button above where you enter your post, and you'll see them. then paste your source code between them to preserve your spacing. It makes the code about 1000% easier to read.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Burak Tass
Greenhorn

Joined: Jun 24, 2009
Posts: 12
Please help me i have to do this now if i can't do this i will fail in exam
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18829
    
  40

Burak Tass wrote:Please help me i have to do this now if i can't do this i will fail in exam


Well, first, you can get rid of all the prime() stuff -- that for a different homework problem.

As for reverse(), it looks like you have written one that will reverse a string. Now, you just need to convert number to string and back -- and take care of negative numbers too. Pretty straightforward, give it a shot...

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Burak Tass
Greenhorn

Joined: Jun 24, 2009
Posts: 12
ok I see you don't help me and i will fail if you don't send me codes
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11311
    
  16

Burak Tass wrote:ok I see you don't help me and i will fail if you don't send me codes

I am a professional coder. I write Java, Perl, C/C++ and other languages for a living.

I would be happy to provide the answer to ALL three of your problems at my standard rate of $300 / hour, with a four hour minimum. Once you have deposited the money into my paypal account, I will start writing your code for you, and provide it to you as soon as possible.

You may be able to find cheaper folks here.

Let me be blunt:

DO NOT ASK FOR SOMEONE TO GIVE YOU THE SOLUTION AGAIN IN ANY OF YOUR THREE THREADS.
W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
I will start by apologizing to the orignal poster if I am incorrect in my next set of statements.

Judging by your other threads, and the fact you are asking us to write code for you, I highly doubt the code you posted was written by you. Not only is it pretty lengthy code (albeit not that complex) but huge chunks of it do not relate to the problem you are asking us about.

With that said, Henry has pretty much told you EXACTLY what you have to do. I would suggest a quick google search for "java convert int to string" and "java convert string to int" will probably tell you how to do what you require.

And, since I haven't seen it mentioned by anyone else yet, UseAMeaningfulSubjectLine.


SCJA
When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Totally off-topic, but I have a towel signed by Douglas Adams.
Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
This sounds like it might be an exercise in recursive programming . The idea of displaying the characters of a string in reverse order, without actually reading the string in reverse order, or without storing the characters in reverse order, is a problem that lends itself to recursive solution.

The following link may be of use to you.

http://erwnerve.tripod.com/prog/recursion/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please help meeeee