Hello,

I am fairly new to using Java, and something I wish to do is create a Java program to calculate and display the distance between pairs of (x,y) points supplied from a text file.

I'm using xCode on Mac OS X, and I've got a file named "data.txt" in the "Build" folder of my "distances.xcode" folder - "data.txt" consists of lines such as this:

(0,0) (1,8)
(0,0) (-26,-3)

(in between each set of numbers it is a tab, not a space, however I can't use a tab on the board when posting a message)

Anyway... I am unsure as to what code I should use. I want the Java application to show the distance based on what is contained in the "data.txt" file, and I also want the user to be able to specify how many decimal places the result will be before the answer is given. Also if the data in the text file is changed to something like:

sdhfjbbhj

I want it to display that it is invalid data. So, if anyone can help me, I would be appreciative.

Regards,

Elektro

I have posted something similiar to what you require, follow the link:

LINK

That should help ya!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.