Question: Write a method called quadrant that accepts as parameters a pair of double values representing an (x, y) point and returns the quadrant number for

Write a method called quadrant that accepts as parameters a pair of double values representing an (x, y) point and returns the quadrant number for that point. Recall that quadrants are numbered as integers from 1 to 4 with the upper-right quadrant numbered 1 and the subsequent quadrants numbered in a counterclockwise fashion:

у-аxis Quadrant 2 Quadrant I х-аxis Quadrant 3 Quadrant 4

Notice that the quadrant is determined by whether the x and y coordinates are positive or negative numbers. Return 0 if the point lies on the x- or -axis. For example, the call of quadrant(-2.3, 3.5) should return 2 and the call of quadrant(4.5, -4.5) should return 4.

-xis Quadrant 2 Quadrant I -xis Quadrant 3 Quadrant 4

Step by Step Solution

3.34 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public static int quadrant double x doub... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Building Java Programs A Back to Basics Approach Questions!

Related Book