Advertisement
zainarfi00

Quadrant Project

Oct 18th, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. /**
  2. * Quadrant Project
  3. *
  4. * Zain Arfi
  5. * @version (a version number or a date)
  6.  
  7. */
  8. import java.util.*;
  9. public class Quadrant
  10. {
  11. public static void main(String[] args)
  12. {
  13. Scanner console = new Scanner(System.in);
  14. System.out.println("What is x?");
  15. double coor1 = console.nextDouble();
  16. System.out.println("What is y?");
  17. double coor2 = console.nextDouble();
  18. double quad = Calculate( coor1 , coor2 );
  19. System.out.println(quad);
  20. }
  21. public static double Calculate(double x, double y)
  22. {
  23. if( x > 0 && y > 0)
  24. {
  25. return 1;
  26. }
  27. if ( x < 0 && y > 0)
  28. {
  29. return 2;
  30. }
  31. if ( x < 0 && y < 0)
  32. {
  33. return 3;
  34. }
  35. else
  36. {
  37. return 4;
  38. }
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement