It's not a secret anymore!*
The moose likes Beginning Java and the fly likes HELP! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

HELP!

Vannie Vo
Greenhorn

Joined: Feb 09, 2003
Posts: 5
I need help on this java problem, can anyone please help me???:
"Suppose we have this Point Class"
public class Point {
int X;
int Y;
Point(int w, int h){
X = w;
Y = h;
//finish this method that computes the distance
//between this Point and an x and y coordinat.
public double distance(int w, int h) {
//Your code here. Any suggestions anyone?
}
----------------------------------------------
Another problem related to the problem above:
"Create a method called distance that looks like this. This is part of the Point class"
public double distance(Point p){
//Your code here
}
Thank you....Vannie
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Pythagoras is the guy you need to talk to...


Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121

Barry,
If you're talking about the Pythagoras that lived in ancient Greece and invented the theorem (that bears his name), then please excuse me, but (if I'm not mistaken) he died several thousand years ago, therefore I don't think it would be possible to talk to him -- so (and pardon my ignorance) how would that help Vannie?
Of-course, Pythagoras' theorem can be used to help Vannie solve his (her?) problem. Pythagoras' theorem is a mathematical theorem which details an equation that can be used to calculate the distance between two points lying on the same plane (i.e. two-dimensional space).
I'm guessing, Vannie, that an Internet search for the words "Pythagoras" and "theorem" would probably turn up more than enough information for you to complete this exercise yourself. But then again, if you INSIST on having someone else do the work for you, perhaps the following web-sites would be helpful:
http://www.hotdispatch.com
http://www.helpshare.com
http://www.experts-exchange.com
Good Luck,
Avi.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
If you're talking about the Pythagoras that lived in ancient Greece and invented the theorem (that bears his name), then please excuse me, but (if I'm not mistaken) he died several thousand years ago, therefore I don't think it would be possible to talk to him -- so (and pardon my ignorance) how would that help Vannie?

Yes, that's the one. He lives on the same block as Elvis nowadays.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
The in Barry's post may be interpreted as "Warning: this is a JOKE! Do not attempt to interpret too literally!" Of course, Barry also provided a nice Googleable keyword which could be used to get a more serious answer. Or it might just serve as a reminder of some basic geometry which most of us probably encountered in school, though some have forgotten...
[ February 09, 2003: Message edited by: Jim Yingst ]

"I'm not back." - Bill Harding, Twister
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

To the original poster: did any of that help or are you still confused?
Do you know the formula to calculate the distance between two points? I only ask because that isn't a 'java' thing. If you know the formula and don't know how to use it in your class, than that is a 'java' question.
[ February 10, 2003: Message edited by: William Barnes ]

Please ignore post, I have no idea what I am talking about.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Just waiting for the next 'integer square root' thread to start ...
Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401
I am curious as to why no one just didn't give him the formula? Z^2 = X^2 + Y^2


doco
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Because it doesn't compile...
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Originally posted by doco mastadon:
I am curious as to why no one just didn't give him the formula? Z^2 = X^2 + Y^2

This is JavaRanch, a friendly place for Java greenhorns to meet. We strive to live up to that name.
Bear in mind, however, this is a credo to be fulfilled by those who participate; we're all people here, and we all have our peeves. One of them is posts with names like "Help!" that have homework questions in them.
We like helping people learn Java; we don't like doing it for them. Asking others to do your work so you can call it your own might be good capitalism, but it's lousy academics, and it's a good idea to put nice aside long enough to say we don't think it's cool.
Vannie Vo
Greenhorn

Joined: Feb 09, 2003
Posts: 5
Well Ernest,
I'm not asking anyone to do my homework for me. I indeed am aware of the distance formula; it�s just that in the problem stated above, I�m not quite sure on how to incorporate it into the program. Like I said in my topic, I�m asking for assistance not for someone to write out the program for me. I�m taking my first programming course in java and the first problem I run into, I come to you guys for some assistance and all I get is cynical criticism. Thanks for your encouragement for any future questions.
On the other hand, a huge thank you goes to all of the former replies whose mere purpose was to �help� and not answer my question with sarcasm. I�ve figured it out.
Thanks,
Vannie
Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401
I see. I suppose I am a bit more nieve than I thought :roll:
Thanks
doco
Vannie Vo
Greenhorn

Joined: Feb 09, 2003
Posts: 5
By the way Ernest,
Just because posts titled �Help!� annoys you, it shouldn�t prompt you to automatically beat down the person who posted it. Did it ever occur to you that maybe it�s titled that way for the sole purpose of my needing someone to answer it right away??! Think about it,�.
Later . . .
Vannie
Donald R. Cossitt
buckaroo
Ranch Hand

Joined: Jan 31, 2003
Posts: 401
Vannie...
It's not what happens to you in life that matters it's how you respond to it. Burning this bridge won't help. Do like the lawyers do when their objections are over ruled: think about what you want and ask it a different way. Chill out - It'll be ok. OK?
doco
Vannie Vo
Greenhorn

Joined: Feb 09, 2003
Posts: 5
Doco,
You were very helpful, it wasn't intended for you to read it...
Thanks for the help
Vannie
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1121


Does this help you?
Good Luck,
Avi.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Vannie,

Welcome to Javaranch. Too many people title their posts with titles that do not indicate to the reader what they need urgent help with. What if every post that asked a question here (thousands of them) were titled HELP! or URGENT!

I'm glad you found an answer that helped you.

Please read the Javaranch policy on displayed names and change your display name from Vixen to one that fits the rule.

Thanks.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

Originally posted by Vannie Vo:
By the way Ernest,
Just because posts titled �Help!� annoys you, it shouldn�t prompt you to automatically beat down the person who posted it. Did it ever occur to you that maybe it�s titled that way for the sole purpose of my needing someone to answer it right away??! Think about it,�.

For starters, please review this site's naming policy. We ask all users to post with a first and last name to give the boards a more 'professional' look and feel. The policy itself will say more on this point. We'd appreciate it if you'd change your screen name accordingly.
Second, my name is Michael. You can call me that or Mr. Ernest, if that's your wish. If disrespect is your intent, say whatever you like.
Third, it does occur to me that "Help!" conveys one message. It's just not a message that gives the reader a sense of your subject.
Most people here do want to help others learn Java. That's why people bother to read a "Help!" (or an "Urgent!") topic to begin with. But when that topic contains a homework question -- as you've admitted yours does -- it means Stop! Drop what you're doing! I have a homework question! This is critical!. People who take the time to open up a "Help!" might indeed feel annoyed; you seem to think they have an obligation to be nice, whether or not you've been considerate enough to ask for their time wisely.
If I don't tell you in the nicest terms possible that you're expressing yourself as lazy, inconsiderate, and in a rush, it's only because I expected precisely the response you offered: a bratty, defensive retort about what's wrong with anyone who didn't fill in your code blank and thank you for the chance to do it.
You're under no obligation to take my comments as constructive in any way, but then you already know that.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
And the most important (to me) thing Vixen now says:
I�ve figured it out
.
Did Vixen read a book, or class notes, in the meanwhile?
Vixen, now post your attempt ( and conform to the naming policy ) and you will get all the constructive assistance that you desire.
-Barry
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

I am curious as to why no one just didn't give him the formula? Z^2 = X^2 + Y^2

Well I didn't know the formula, ...
 
jQuery in Action, 2nd edition
 
subject: HELP!
 
Similar Threads
Resizing, Dragging and Rotating
finding closest point
Slider not working
static reference to nonstatic var & methods
HELP!