Java write a program in java that uses a method called


JAVA) write a program IN JAVA that uses a method called quadrant that accepts as parameters a pair of double values representing an (x, y) point and returns the quadrant number for that point. Recall that quadrants are numbered as integers from 1 to 4 with the upper-right quadrant numbered 1 and the subsequent quadrants numbered in a counterclockwise fashion: xid-111609318_1 Notice that the quadrant is determined by whether the x and y coordinates are positive or negative numbers. Return 0 if the point lies on origin (point 0,0). return a -1 if the point is on the x axis, return -2 if the point is on the y axis. For example, the call of quadrant(-2.3, 3.5) should return 2 and the call of quadrant(4.5, -4.5) should return 4. The values for x and y should be entered by the user, and the where the point is located should be output by another method Name the class project3............................ based offf

import java.util.*;

public class h.w

{public static void main(String[] args)

{Scanner in=new Scanner(System.in);

double a,b,c;

a=input(in,"enter a");

b=input(in,"enter b");

c=input(in,"enter c");

solution(a,b,c);

}

public static void solution(double a,double b,double c)

{double x1,x2,disc,den;

disc=Math.pow(b,2)-4*a*c;

if(disc {System.out.println("no real solutions");

}

if(disc>=0)

{System.out.println("has real solutions:");

if(disc==0)

{x1=(-b+Math.sqrt(disc))/(2*a);

System.out.println("1 root: "+x1);

}

else

{x1=(-b+Math.sqrt(disc))/(2*a);

x2=(-b-Math.sqrt(disc))/(2*a);

output(x1,x2);

}

}

}

public static void output(double x1,double x2)

{System.out.println("Solutions:nx1="+x1+"nx2="+x2);

}

public static double input(Scanner in,String variable)

{

System.out.print(variable+": ");

return in.nextDouble();

}

}

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Java write a program in java that uses a method called
Reference No:- TGS01189292

Expected delivery within 24 Hours