Write a program in java that uses a method called quadrant

Assignment Help JAVA Programming
Reference no: EM13896093

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();

}

}

Reference no: EM13896093

Questions Cloud

What is role of advertising spending in experience markets : What is the role of advertising spending in experience good markets? Are spending caps welfare increasing? If a firm faces asymmetric information and it has to invest in R&D to increase the probability of high quality.
What is meant by statistical inference : What is meant by statistical inference? What is its function and importance and What is meant by and what is the relationship between a parameter and a statistic?
Why hook is important : why Hook is important
How could we use their work to understand similar changes : How did they judge these historical developments, the nature of modern society, and prospects for the future of humanity? How could we use their work to understand similar changes brought about by globalization today
Write a program in java that uses a method called quadrant : 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 ..
Market interest rate currently-what is market price of bond : You buy a 3-year, 10% coupon bond with face value $1000 today. The market interest rate currently is 10% also. What is the market price of the bond today?
What is the meaning of pure and mixed bundling : What is the meaning of pure and mixed bundling? Give a real-world example for each practice. What is the intuition that bundling (pure or mixed) can increase profits compared to separate selling?
What is the expected value and standard deviation : A manufacturing process produces on the average two defective items per hour. What is the probability that after a defective item: One hour will pass before the next defective item and One-half hour will pass?
Adjusting entry to reflect any necessary fair value : Prepare Prescrip's December 31, 2013, adjusting entry to reflect any necessary fair value adjustment for theseinvestments.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write a java program that finds the temperature

Write a JAVA program that finds the temperature that is the same in both Celsius and Fahrenheit

  Explain the meaning of array index out of bounds

Explain the meaning of "array index out of bounds".

  Organization structure change over time

How and why did the organization structure change over time, and in what ways were some of these changes responsible for some of their recent problems?

  What is an example of a javascript framework

What is an example of a JavaScript(r) framework? In the framework you have described, what is an example of an application that would work well on the site you are building for the class? What is the purpose of the application and how will it enha..

  Explain the difference between throwing an exception and

question 1. what is the difference between throwing an exception and catching an exception?question 2. how does a

  Despite public and private health insurance programs

Why is it that despite public and private health insurance programs, some US citizens are without health coverage?

  The string class and/or the stringbuffer class in java

Create a simple Java application that uses the String class and/or the StringBuffer class and at least 4 of the class methods. Show the code, demonstrate it works properly and describe what it is doing.

  Java problem - g queue

A queue is an ordered collection of items in which the removal of items is restricted to the FIFO ( rst in rst out) principle.

  Write a program that creates a two-dimensional array

Write a program that creates a two-dimensional (2D) array initialized with test data (for instance, use Random method to prepare an array of integers).

  Write a method named longestword

Write a method named longestWord that accepts a String as its parameter and returns the length of the longest word in the string.

  Describe the multithreading

Describe multithreading and list the reasons for using multithreading

  Information systems to strengthen customer

Which of the following illustrates the use of information systems to strengthen customer and supplier intimacy? BPM is considered concluded when the new processes are both implemented and accepted.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd