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

  Template files contain the message text

Template files contain the message text, together with variable fields(such as Dear [Title] [Last Name ] ...). A database (stored as a text file) contains the field values for each recipient. Use HTML as the output file format. Then design and implem..

  Write a method that will perform the a division operation

Write a method that will perform the a division operation (divide by) on the numbers passed to it in two variables (numerator, denominator) and outputs the results. Use a try-catch pair to output an error message if the illegal operation of divide..

  Design and implement an applet called circles

Design and implement an applet called Circles that draws 50 circles of random diameter in random locations. If the diameter of a circle is less than a certain value, the circle is ?lled with the color yellow.

  Create a program that develops an amortization schedule

Create a program that develops an amortization schedule. Your program should be written as a Java applet.

  Create a secure parts inventory catalog system

You will create a secure Parts Inventory Catalog system using Model 2 architecture. The application will require a user to have the proper access right to enter the system, and when satisfied, presents the catalog of items currently available in t..

  Method called printpowersof2 that accepts a maximum number

Write a method called printPowersOf2 that accepts a maximum number as an argument and prints each power of 2 from 20 (1) up to that maximum power, inclusive. For example, consider the following calls: printPowersOf2(3); printPowersOf2(10)

  Write an application that extends jframe

Write an application that extends JFrame and that displays a phrase in every font size from 6 through 20.

  What are the main differences between javabeans and applets

What are the main differences between JavaBeans and applets? How do I use an applet that resides on a remote machine?

  Complete the twins() method

Complete the twins() method, which takes an integer argument n and prints all the sets of twin primes that are less than n, one pair per line

  Design a function named "falling distance"

Design a function named "fallingDistance" that accepts an objects falling time, in seconds, as an argument. The function should return the distance, in meters, that the object has fallen during that time interval. Design a program that calls the func..

  Write a java class

Write a Java class called PQueue that extends the provided abstract QueueADT class.

  Concepts of polymorphism

This lab introduces students to the concepts of polymorphism, early binding, late binding, abstract classes, and virtual class functions. This will be done in the context of performing calculations on basic geometrical shapes

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