Bookmark Topic Watch Topic
  • New Topic

HELP!

 
Vannie Vo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
  • Report post to moderator
Pythagoras is the guy you need to talk to...
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
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 ]
 
William Barnes
Ranch Hand
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Report post to moderator
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 ]
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Report post to moderator
Just waiting for the next 'integer square root' thread to start ...
 
Donald R. Cossitt
buckaroo
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Report post to moderator
I am curious as to why no one just didn't give him the formula? Z^2 = X^2 + Y^2
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Report post to moderator
Because it doesn't compile...
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
  • Report post to moderator
I see. I suppose I am a bit more nieve than I thought :roll:
Thanks
doco
 
Vannie Vo
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
Doco,
You were very helpful, it wasn't intended for you to read it...
Thanks for the help
Vannie
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Report post to moderator

Does this help you?
Good Luck,
Avi.
 
Marilyn de Queiroz
Sheriff
Posts: 9061
12
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 7729
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 986
Eclipse IDE Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
  • Report post to moderator
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, ...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic