Computers and Technology

Please solve this in JAVA. Ps: This is not the exacy same program as previous one where it has an enum SIGNUM it's similar but not same this one is only enum Quadrant so please solve this according to the question and not just copy paste from the old problems. Quadrant (the code):
public enum Quadrant {
// code
}
We will model the four quadrants with a Java enumeration which will contain only 4 elements and a few methods. The enumeration will have a main() method that takes command line arguments that are pairs of numbers and prints which quadrant the pair belongs to.
Note that there is some ambiguity as to which quadrant pairs with a 0 belong in: the pair (0, 11) exists on the boundary between Q1 and Q2 while the origin (0,0) could be said to belong to any of the quadrants. We will dodge that issue by not testing such cases so your code may behave any way you wish.
Fields & Methods:
Q1, Q2, Q3, Q4
There are four elements of the Quadrant enumeration: Q1, Q2, Q3, Q4. Ensure that these are all present and no other exist.
public boolean xPositive();
public boolean yPositive();
These two simple accessors indicate whether the coordinates of the Quadrant are positive or negative. In order to make this functionality easy, it is helpful to define some private fields and a private constructor.
public String signPair()
Quadrants can return a pretty string which indicates the sign of the x and y values they contain. These are the strings
(+,+) for Q1
(-,+) for Q2
(-,-) for Q3
(+,-) for Q4
public Quadrant flipX();
For a coordinate (x, y) in this Quadrant, method flipX() should return the Quadrant that would the coordinate (-x, y) would belong to.
public static Quadrant fromInts(int x, int y)
This function returns the Quadrant in which the pair (x, y) would fall. As noted earlier, if x or y are 0, multiple quadrants apply. Return any valid choice in such cases but know that this case will not be tested in the test cases.
Example
From an interactive session in DrJava
Welcome to DrJava.
> Quadrant q = Quadrant. fromInts(1,4);
> q
Q1
> q = Quadrant. fromInts(11,-34);
> q

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 03:10, brylove603
Write a program that begins by reading in a series of positive integers on a single line of input and then computes and prints the product of those integers. integers are accepted and multiplied until the user enters an integer less than 1. this final number is not part of the product. then, the program prints the product. if the first entered number is negative or 0, the program must print “bad input.” and terminate immediately. next, the program determines and prints the prime factorization of the product, listing the factors in increasing order. if a prime number is not a factor of the product, then it must not appear in the factorization. sample runs are given below. note that if the power of a prime is 1, then that 1 must appear in t
Answers: 3
image
Computers and Technology, 23.06.2019 12:30, legend101xD
Animations and transitions are added from the
Answers: 1
image
Computers and Technology, 23.06.2019 18:00, fordkenae
Which is a possible benefit of having a good credit history? having a checking account low interest rate on a car loan high interest rate on a credit card offer bankruptcy
Answers: 1
image
Computers and Technology, 24.06.2019 06:30, hannahgracew12
Some peer-to-peer networks have a server and some don't. true false
Answers: 2
Do you know the correct answer?
Please solve this in JAVA. Ps: This is not the exacy same program as previous one where it has an en...

Questions in other subjects:

Konu
English, 05.10.2020 16:01
Konu
English, 05.10.2020 16:01