wood burning stoves 2.0
The moose likes Beginning Java and the fly likes DistanceFinder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "DistanceFinder" Watch "DistanceFinder" New topic


Theresa Marlin
Ranch Hand

Joined: Sep 23, 2009
Posts: 49
I had to write a program that found the distance between three points.

When I wrote the program, it said that I needed 1. to put a close parentheses at the end (41), and 2. put an identifier in line 23
I'm not sure why I would need a close parentheses at the end of my code, and I also already have an identifier. Does anyone know where I'm messing up?

K. Tsang

Joined: Sep 13, 2007
Posts: 3059

Hello Theresa,

The problem with your program is 1) it is complaining there no closing brace for the class and 2) the parameters for the distanceFinder method are all Points so it should read distanceFinder(Point x, Point y, Point z) just like the constructor - you can't have Point(doube a,b).

To better organize your code, you may want to use braces for if-else statements. Then you should see what went wrong (1).

K. Tsang JavaRanch SCJP5 SCJD OCPJP7 OCPWCD5 OCPBCD5 OCPWSD5 OCMJEA5 part 1 part 2/3
Theresa Marlin
Ranch Hand

Joined: Sep 23, 2009
Posts: 49
Thank you!!! I am just learning classes and still having a bit of trouble with them.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 45277
That looks very peculiar. Why have you got a point with 6 coordinates?
Theresa Marlin
Ranch Hand

Joined: Sep 23, 2009
Posts: 49
I'm sorry for the typo, it should read: //the points' coordinates (2 for each point)
I agree. Here's the link: http://aspose.com/file-tools
subject: DistanceFinder
jQuery in Action, 3rd edition