Week 1 : Java Fundamentals – Data Types, Control Loops solution

$14.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (2 votes)

Write a program that prints the quadrant number of a point (x,y) on a plane. Recall that points in quadrant 1 have positive x and y values, points in quadrant 2 have a negative x value and a positive y value, points in quadrant 3 have negative x and y values, and the remaining points are in the quadrant 4. If a point is on an axis, choose the quadrant with the lower quadrant number.

Name the source code of this program as P1.java and the compiled class code as P1.class (this is automatically done after compilation) inside the sub-directory lab1.

Test cases: 4 points : each from one of the four quadrants, e.g., (1,1), (-1, 1), (-1, -1), (1, -1).

Expected outputs: (1,1) – quadrant 1; (-1, 1) – quadrant 2; (-1, -1) – quadrant 3; (1, -1) – quadrant 4.