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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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