0

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

2
Contributors
1
Reply
3
Views
12 Years
Discussion Span
Last Post by rickste_r
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.