Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. package exc;
  2. import java.util.Scanner;
  3. public class WorldMap1 {
  4. public static void main(String[] args) {
  5. Scanner input = new Scanner(System.in);
  6. System.out.print("Please enter coordinates of first x");
  7. float x = input.nextFloat();
  8. System.out.print("Please enter coordinates of first y");
  9. float y = input.nextFloat();
  10. System.out.print("Please enter coordinates of second x");
  11. float x1 = input.nextFloat();
  12. System.out.print("Please enter coordinates of second y");
  13. float y1= input.nextFloat();
  14.  
  15. float minus_x = x - x1;
  16. float minus_y = y - y1;
  17.  
  18. if (minus_x == 0 && minus_y == 0){
  19. System.out.println("This is the same place");
  20. }
  21. if (minus_x == 0 && minus_y > 0){
  22. System.out.println("This point is to West");
  23. }
  24. if (minus_x == 0 && minus_y < 0){
  25. System.out.println("This point is to East");
  26. }
  27. if (minus_x<0 && minus_y == 0){
  28. System.out.println("This point is to South");
  29. }
  30. if (minus_x>0 && minus_y ==0){
  31. System.out.println("This point is to North");
  32. }
  33. if (minus_x>0 && minus_y>0){
  34. System.out.println("This point is to NorthWest");
  35. }
  36. if (minus_x<0 && minus_y<0){
  37. System.out.println("This point is to SouthEast");
  38. }
  39. if (minus_x>0 && minus_y<0){
  40. System.out.println("This point is to NorthWest");
  41. }
  42. if (minus_x<0&& minus_y>0){
  43. System.out.println("This point is to SouthWest");
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement