ARTICLE

How to find the Quadrant an Algorithm

Posted by Sapna Articles | Algorithms and VB.NET February 11, 2011
Quadrant is called that one of the four sections made by dividing an area with two perpendicular lines.
 
Reader Level:

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.

Login to add your contents and source code to this article
share this article :
post comment
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Team Foundation Server Hosting
Become a Sponsor