I would like some help with this program that I wrote for my class project. I have a class Point, class Circle and a main test program. I'm having difficulty with where to put some if else statements to find the quadrant that the points x,y are located. I wrote a bunch of if else statements to find the quadrant but I can't seem to get the test program to print them in my output box. Where would I place the code for this? class Point? How do I get the test program to recognize it? I'm a little confused but it may be because I'm over-thinking the solution. I'm not asking for anyone to do my homework I just need a little push in the right direction. Any help would be greatly appreciated....
I posted my code below.......

// Example: Point.java
// Definition of class Point

public class Point {
   protected int x, y; // coordinates of Point

   // No-argument constructor
   public Point()
   {
      // implicit call to superclass constructor occurs here
      setPoint( 0, 0 );
   }

   // constructor
   public Point( int xCoordinate, int yCoordinate )
   {
      // implicit call to superclass constructor occurs here
      setPoint( xCoordinate, yCoordinate );
   }

   // set x and y coordinates of Point
   public void setPoint( int xCoordinate, int yCoordinate )
   {
      x = xCoordinate;
      y = yCoordinate;
   }

   // get x coordinate
   public int getX() 
   { 
      return x;
   }  

   // get y coordinate
   public int getY() 
   { 
      return y;
   }  

   // convert into a String representation
   public String toString()
   {
      return "[" + x + ", " + y + "]";
   }

}  // end class Point
// Example: Circle.java
// Definition of class Circle

public class Circle extends Point {  // inherits from Point
   protected double radius;

   // no-argument constructor
   public Circle()
   {
      // implicit call to superclass constructor (default) occurs here
      setRadius( 0 );  
   }

   // constructor
   public Circle( double circleRadius, int xCoordinate, 
      int yCoordinate )
   {
      // call superclass constructor to set coordinates
      super( xCoordinate, yCoordinate );  

      // set radius
      setRadius( circleRadius );  
   }

   // set radius of Circle
   public void setRadius( double circleRadius ) 
   {
      radius = ( circleRadius >= 0.0 ? circleRadius : 0.0 );
   }

   // get radius of Circle
   public double getRadius() 
   {
      return radius; 
   }

   // calculate area of Circle
   public double area()
   {
      return Math.PI * radius * radius; 
   }

   // convert the Circle to a String (Note that this uses superclass variables, x and y)
   public String toString()
   {
      return "Center = " + "[" + x + ", " + y + "]" +
             "; Radius = " + radius;
   }

}  // end class Circle
// Example: Test2.java
// Application to test class Circle and Point

// Java core packages
import java.text.DecimalFormat;

// Java extension packages
import javax.swing.JOptionPane;

public class Test2 {

   // test class Circle
   public static void main( String args[] )
   {
      // create a Circle (hard-coded, one example object)
      Circle circle = new Circle( 2.5, 37, 43 );
      DecimalFormat precision2 = new DecimalFormat( "0.00" );

      // get coordinates and radius of the first object
      String output = "X coordinate is " + circle.getX() +
               "\nY coordinate is " + circle.getY() +
               "\nRadius is " + circle.getRadius();

      // set coordinates and radius; change the values
      circle.setRadius( 4.25 );
      circle.setPoint( 2, 2 );

      // get String representation of Circle and calculate area using new values
      output +=
         "\n\nThe new location and radius of c are\n" + circle +
         "\nArea is " + precision2.format( circle.area() );

      JOptionPane.showMessageDialog( null, output,
         "Demonstrating Class Circle",
         JOptionPane.INFORMATION_MESSAGE );

      System.exit( 0 );
   }

}  // end class Test

Well, where is your code to find the quadrant? You mentioned that you already wrote it, but you did not post it. Personally, I would just drop that piece of code into the Test2 class you created (or whatever your main class is). You could also put it in your Circle class, though. Since what quadrant you are in has nothing to do with the point itself (it has to do with where the point lies relative to the Circle's center, which is information the Point should not necessarily know about, I wouldn't put it in the Point class, though). However, programmatically speaking, you could put it anywhere you want, and still end up with a functioning program. I'd just personally put it in the main driver class, Test2, (aside of creating an interface that defines the quadrant method and forcing Circle to implement that interface, which really, would be better).

Anyway, sorry for going on a ramble that is probably confusing. If you attempt to put your quadrant method in your main class and get it working, post any problems you have while doing so, and I will help.

Is this correct? I know I need to give the quadrant more detail such as on the x axis or y axis and so on but am I close? I'm also confused about how many quadrants there are. If there are 9 like I'm thinking then my quadrant code is wrong... Thank for your help.

// Example: Test2.java
// Application to test class Circle and Point

// Java core packages
import java.text.DecimalFormat;

// Java extension packages
import javax.swing.JOptionPane;

public class Test2 {

   // test class Circle
   public static void main( String args[] )
   {
      // create a Circle (hard-coded, one example object)
      Circle circle = new Circle( 2.5, 37, 43 );
      DecimalFormat precision2 = new DecimalFormat( "0.00" );

      // get coordinates and radius of the first object
      String output = "X coordinate is " + circle.getX() +
               "\nY coordinate is " + circle.getY() +
               "\nRadius is " + circle.getRadius();

      // set coordinates and radius; change the values
      circle.setRadius( 4.25 );
      circle.setPoint( 2, 2 );
		
		int location;
		int X = circle.getX();
		int Y = circle.getY();
		
  		if (X == 0 && Y != 0)
    		location = 5;
			
      else if (X != 0 && Y == 0)
     	   location = 6;
			
      else if (X == 0 && Y == 0)
      	location = 7;
			
      else if (X > 0 && Y > 0)
         location = 1;
			
      else if (X < 0 && Y > 0)
         location = 2;
			
      else if (X < 0 && Y < 0)
         location = 3;
			
      else
         location = 4;

      // get String representation of Circle and calculate area using new values
      output +=
         "\n\nThe new location and radius of c are\n" + circle +
         "\nArea is " + precision2.format( circle.area() ) +
			"\nLocation is " + location;

      JOptionPane.showMessageDialog( null, output,
         "Demonstrating Class Circle",
         JOptionPane.INFORMATION_MESSAGE );

      System.exit( 0 );
   }

}  // end class Test
This question has already been answered. Start a new discussion instead.