import java.util.Scanner;
import java.io.FileNotFoundException;
import java.io.File;
import java.io.PrintWriter;

class Nov29 {

	public static void main(String[] args) {

		try {
			foo(2);
			//foo(3);
		}
		catch(MyException g) {
			System.out.println("exception caught");
		}
	
		Scanner fin = null;

		try {
			fin = new Scanner(new File("data.txt"));
		}
		catch (FileNotFoundException e) {
			System.out.println("File is not found");
			System.exit(1);
		}	

		fin.useDelimiter(",|\n");

		int numPoints = fin.nextInt();
		System.out.println("numPoints: " + numPoints);

		Point[] arr = new Point[numPoints];
		for(Point p : arr) {
			System.out.println(p);
		}

		for(int i = 0; i < numPoints; i++) {
			int x = fin.nextInt();
			int y = fin.nextInt();
			Point p = new Point(x,y);
			arr[i] = p;
		}
		
		for(Point p : arr) {
			System.out.println(p);
		}

		// print points with odd x coords to odd.txt

		PrintWriter pw = null;

		try {
			pw = new PrintWriter(new File("odd.txt"));
		}
		catch(FileNotFoundException e) {
			System.out.println("Invalid permissions");
			System.exit(1);
		}	

		for(Point p : arr) {
			if(p.getX() % 2 == 1) {
				pw.println(p);
			}	
		}		

		pw.close();

		// test Moto class' equals method

		Moto m1 = new Moto(750, "CRZ-750");
		Moto m2 = new Moto(750, "CRZ-750");
		Moto m3 = new Moto(500, "Suzuki-500");

		if (m1.equals(m2)) {
			System.out.println("motos are equal");
		}
		else {
			System.out.println("motos are NOT equal");

		}


	}

	public static void foo(int x) throws MyException{
		
		MyException e = new MyException();

		if (x % 2 == 1) {
			throw e;
		}

	}


}


