Algorithm Quadrant in VB.NET

Quadrant is called that one of the four sections made by dividing an area with two perpendicular lines.
  • 3888

The problem of finding the Quadrant, by the way what is Quardrant so the answer is here "One of the four sections made by dividing an area with two perpendicular lines; The four regions of the Cartesian plane bounded by the x-axis and y-axis"  in which a given co-ordinate position(x,y) lies is a Computer Graphics problem. In a Cartesian system if both X and Y co-ordinates are positive then it is said to be First Quadrant of the Cartesian plane.One fourth of a circle or disc; a sector with an angle of 90°,  A measuring device with a graduated arc of 90° used in locating an altitude and  If X and Y are both negative then it said to be Third Quadrant of the Cartesian plane. If X is negative and Y is positive then it is said to be Second Quadrant and in case if X is positive and Y is negative then it said to be in the Fourth Quadrant of the Cartesian plane. The Diagram of the Cartesian plane is given in Fig. 3.1 below to make facts more clearer.

quadent.gif
 

The co-ordinate positions thus entered have to fall in either of those Quadrant based on the sign of the X and Y co-ordinate positions.

Algorithm : Quadrant_Finder
Input : x, X co-ordinate
            y, Y co-ordinate
Output : Corresponding Co-ordinate

Method
    If( x >=0)
        If(y>=0)
            Display 'I -Quadrant'
        Else
            Display 'IV-Quadrant'
        end_if
    else
        If(y>=0)
            Display 'II- Quadrant'
        Else
            Display 'III-Quadrant'
        end_if
    end_if

Algorithm ends

Summary

I hope this article help you to clear your concept of designing algorithms for the problems has been presented.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.