jojostar
YaBB Newbies
Offline
Posts: 2
Constructor Problem, help please.
Nov 13th , 2007, 7:50pm
I'm new to processing and I'd like to make a constructor and later an array made of constructors. I did check the help and I've found quite a number of examples of constructors, but when I apply the same code to my sketch it doesn't work. Please help! this is the code in my sketch, atm at least. PFont fontA; fontA = loadFont("CordiaUPC-48.vlw"); textFont(fontA); String[] lines; weatherData table[] = new weatherData[548]; int numLines = 0; lines = loadStrings("Greenwich.txt"); numLines = lines.length; size(500,500); String txt=String.valueOf(numLines); String s; String s1; String s2; String s3; String s4; String s5; String s6; String s7; //for(int i = 20; i<569; i++) //{ s1 = trim(lines[20].substring(3,7)); s2 = trim(lines[20].substring(9,11)); s3 = trim(lines[20].substring(14,18)); s4 = trim(lines[20].substring(22,26)); s5 = trim(lines[20].substring(32,34)); s6 = trim(lines[20].substring(37,42)); s7 = trim(lines[20].substring(45,50)); if(s6.equals("---")) { s6 = "0"; } if(s4.charAt(0) == '-') { s = s4.substring(1); } //} text(s1, 0, 30); class weatherData { int yearw; int monthw; float tmax; float tmin; int af; int rainmm; float sunHours; weatherData(int y, int m, float tx, float tn, int a, int r, float s) { yearw = y; monthw = m; tmax =tx; tmin =tn; af = a; rainmm = r; sunHours = s; } } Don't mind the other part of the code, just the constructor part and the array made of constructors. Anyway, I get the error message: Semantic Error: Type "weatherData" was not found. Please help!