import java.util.InputMismatchException;
import java.util.Scanner;

public class Point2DArray {

	public static void main(String args[])
	{
		int ROW = 3;
		int COL = 3;
		Point[][] pointA = new Point[ROW][COL];
		
	    try (Scanner input = new Scanner(System.in)) {
    	int x=0;
    	int y=0;
		System.out.println("Enter the values of point objects: ");
		for (int i=0; i< ROW ; i++)
		{
			for (int j=0; j < COL; j++)
			{
			    System.out.print("Enter the x coordinate of ["+ i +"] ["+j+"] point: ");
			    x= input.nextInt();
			    System.out.print("Enter the y coordinate of ["+ i +"] ["+j+"] point: ");
			    y= input.nextInt();
			    pointA[i][j] = new Point(x,y);
			}
		}
			
		System.out.println("Point objects in the matrix are: ");
		int count0=0;
		int count1=0;
		int count2=0;
		int count3=0;
		int count4=0;
		String quad=null;
		for (int k=0; k < ROW; k++)
		{
			for (int j=0; j < COL; j++)
			{
				System.out.print(pointA[k][j]+ " ");
				quad = pointA[k][j].getQuadrant();
				if (quad.equals("0")) count0++;
				else
					if (quad.equals("I")) count1++;
					else
						if (quad.equals("II")) count2++;
						else
							if (quad.equals("III")) count3++;
							else
								if (quad.equals("IV")) count4++;
			}
			System.out.println();
		}

		System.out.println("The number of points is Quad I are: "+ count1);
		System.out.println("The number of points is Quad II are: "+ count2);
		System.out.println("The number of points is Quad III are: "+ count3);
		System.out.println("The number of points is Quad IV are: "+ count4);
		System.out.println("The number of points which do not belong to any quadrant are: "+ count0);
		
		} catch (InputMismatchException  e)
		 {
		 	System.out.println("Error reading input");
		 }
	}
}
