babs
YaBB Newbies
Offline
Posts: 7
Please help
Feb 18th , 2010, 6:38am
HI im toatally new to processing, ive been using Ben Fry's visualizing data book and working through the chapters. Im trying to edit chapter 6 so that instead of a map of USA a college map is loaded and when i type the name of my lecturer, their office is located on the map. This is my code for loading the data static final int DEPARTMENT = 0; static final int X = 1; static final int Y = 2; static final int NAME = 3; int totalCount; // total number of lecturers Lecturer[] lecturers; int lecturerCount; // min/max boundary of all points float minX, maxX; float minY, maxY; public void setup() { readData(); } void readData() { String[] lines = loadStrings("lecturer.csv"); parseInfo(lines[0]); // read the header line lecturers = new Lecturer[totalCount]; for ( int i = 1; i < lines.length; i++){ lecturers[lecturerCount] = parseLecturer(lines[i]); lecturerCount ++; } } void parseInfo(String line) { String infoString = line.substring(2); // remove the # String[] infoPieces = split(infoString, ','); totalCount = int(infoPieces[0]); minX = float(infoPieces[1]); maxX = float(infoPieces[2]); minY = float(infoPieces[3]); maxY = float(infoPieces[4]); } Lecturer parseLecturer(String line) { String pieces[] = split(line, TAB); String department = pieces[DEPARTMENT]; String name = pieces[NAME]; float x = float(pieces[X]); float y = float(pieces[Y]); return new Lecturer(department, name, x, y); } and I used a second class called Lecturer class Lecturer { String department; String name; float x; float y; public Lecturer(int department, String name, float x, float y) { this.code = code; this.name = name; this.x = x; this.y = y; } } when i run this I get the error the constuructor test.lecturer(String, String, Float, Float) is undefined if anyone can help me id really appreciate it. Thanks in advance