import javax.swing.JFrame; import java.awt.*; import java.io.*; public class prob102 { public prob102() { //setTitle("Problem 102"); try { BufferedReader in = new BufferedReader(new FileReader("prob102data.txt")); String l = ""; int total=0; while ((l = in.readLine()) != null) { String [] p = l.split(","); int x1 = Integer.parseInt(p[0]); int y1 = Integer.parseInt(p[1]); int x2 = Integer.parseInt(p[2]); int y2 = Integer.parseInt(p[3]); int x3 = Integer.parseInt(p[4]); int y3 = Integer.parseInt(p[5]); total += check(x1,y1,x2,y2,x3,y3); } System.out.println("Total: " + total); } catch (Exception e) { System.out.println("Error."); } } public int check(int x1,int y1,int x2,int y2,int x3,int y3) { int [] xp = {x1, x2, x3}; int [] yp = {y1, y2, y3}; Polygon p = new Polygon(xp,yp,3); int toReturn = 0; if (p.contains(0,0)) toReturn = 1; return toReturn; } public static void main(String[] args) { prob102 tp = new prob102(); } }