Java program to read coordinate points and determine its quadrant
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
In this program, we will read X, Y coordinate points from the user and determine the quadrant.
Program/Source Code:
The source code to read coordinate points and determine their quadrant is given below. The given program is compiled and executed successfully.
Output:
Explanation:
In the above program, we imported the "java.util.Scanner" package to read input from the user. And, created a public class Main. It contains two static methods determineQuadrant() and main().
The determineQuadrant() method is used to determine the quadrant based on given coordinates.
The main() method is an entry point for the program. Here, we read coordinates X, Y from the user using the Scanner class. Then we determined the quadrant and printed the result.