I'm working on a project for shipping maps. I've created an object called Chart and an object called Pos for the position. What i can't get to work is that when i read te charts from a text file to create the object Pos correctly because that is where it fails.
Now here is the Pos Class
private Pos Pos;
public Pos(int d, int m, int t){
Pos pos = new Pos(d,m,t);
}
Now here is the Chart class
private String title;
private String colorString;
private String scale;
private String edition;
private Pos north;
private Pos south;
private Pos west;
private Pos east;
private Chart Chart;
public Chart(Pos north, Pos south, Pos west, Pos east, String color, String scale, String edition, String title){
Chart = new Chart(north, south, west, east, color, scale, edition, title);
}
Now here is where i want the code to create charts. I've made a lot of small steps to make sure the output is correct:
In in;
String fileName = "charts.txt";
int aantalKaarten;
int kolommen;
String[][] tabel;
int n1,n2,n3,s1,s2,s3,w1,w2,w3,e1,e2,e3;
String color;
String edition;
String scale;
String title;
in = new In(fileName);
aantalKaarten = in.readInt()+1;
for(int i = 0;i < aantalKaarten;i++){
try {
n1 = in.readInt();
n2 = in.readInt();
n3 = in.readInt();
System.out.println("Noordelijke lengtegraad: " + n1 + ", " + n2 + ", " + n3);
s1 = in.readInt();
s2 = in.readInt();
s3 = in.readInt();
System.out.println("Zuidelijke lengtegraad: " + s1 + ", " + s2 + ", " + s3);
w1 = in.readInt();
w2 = in.readInt();
w3 = in.readInt();
System.out.println("westelijke breedtegraad: " + w1 + ", " + w2 + ", " + w3);
e1 = in.readInt();
e2 = in.readInt();
e3 = in.readInt();
System.out.println("oostelijke breedtegraad: " + e1 + ", " + e2 + ", " + e3);
color = in.readString();
System.out.println("De kleur van de kaart: " + color);
edition = in.readString();
System.out.println("Editie: " + edition);
scale = in.readString();
System.out.println("Schaal: " + scale);
title = in.readLine();
System.out.println("Kaart: " + title);
System.out.println("");
Pos north = new Pos(n1,n2,3);
Pos south = new Pos(s1,s2,s3);
Pos west = new Pos(w1,w2,w3);
Pos east = new Pos(e1,e2,e3);
Chart chart = new Chart(north, south, west, east, color, scale, edition, title);
}
catch(NoSuchElementException eNSEE){
System.out.println("No such element exception");
}
}
in.close();
I'm really hoping i could get some help because i'm hopelessly stuck. Probaly the changes made to Pos i also have to alter to Chart because the build up is the same
Thanks in advance for the help.
edit:
This is the text file that i am processing
20
51 53 00 3 49 00 51 49 70 3 59 00 B ed:2011/2012 1:50.000 ANWB Z 5
51 53 00 3 59 00 51 49 70 4 09 15 B ed:2011/2012 1:50.000 ANWB Z 6
51 49 50 3 28 90 51 42 10 3 49 00 B ed:2011/2012 1:50.000 ANWB Z 7-8
51 49 50 3 49 00 51 42 10 4 09 00 B ed:2011/2012 1:50.000 ANWB Z 9-10
51 41 80 3 19 20 51 34 00 3 39 60 B ed:2011/2012 1:50.000 ANWB Z 11-12
51 42 20 3 39 40 51 34 40 3 59 70 B ed:2011/2012 1:50.000 ANWB Z 13-14
51 42 40 3 59 70 51 34 60 4 19 80 B ed:2011/2012 1:50.000 ANWB Z 15-16
51 42 60 4 19 60 51 34 80 4 29 80 B ed:2011/2012 1:50.000 ANWB Z 17
51 34 20 3 19 80 51 26 80 3 39 90 B ed:2011/2012 1:50.000 ANWB Z 19-20
51 34 60 3 39 80 51 26 80 4 00 00 B ed:2011/2012 1:50.000 ANWB Z 21-22
51 34 60 3 59 70 51 27 20 4 20 00 B ed:2011/2012 1:50.000 ANWB Z 23-24
51 26 70 3 20 00 51 19 00 3 40 20 B ed:2011/2012 1:50.000 ANWB Z 25-26
51 27 00 3 40 00 51 19 40 4 00 00 B ed:2011/2012 1:50.000 ANWB Z 27-28
51 27 15 4 00 00 51 19 60 4 20 20 B ed:2011/2012 1:50.000 ANWB Z 29-30
51 27 60 2 28 60 51 00 00 2 58 40 G ed:2012 1:100.000 Hydro 1801.2
51 32 00 2 51 60 51 13 70 3 36 00 G ed:2012 1:100.000 Hydro 1801.3
51 30 50 3 22 50 51 20 50 3 44 30 G ed:2012 1:50.000 Hydro 1801.4
51 48 60 3 00 00 51 30 40 3 40 00 G ed:2012 1:100.000 Hydro 1801.5
52 00 06 3 23 00 51 42 40 4 07 20 G ed:2012 1:100.000 Hydro 1801.6
52 15 60 3 46 40 51 57 60 4 29 60 G ed:2012 1:100.000 Hydro 1801.7