test
testunknown
java
3 years ago
985 B
7
Indexable
public static void main(String[]args) { System.out.println("Please enter a Letter:"); int x = A.nextInt(); if(x==0 || x==360) { System.out.println("Bearing is N"); } else if(x== 180) { System.out.println("Bearing is S"); } else if(x== 90) { System.out.println("Bearing is E"); } else if(x==270) { System.out.println("Bearing is W"); } else if(x<90) { System.out.println("N" + x + "E"); } else if(x<360&&x>270) { System.out.println("Bearing is N "+ (360-x) +" W"); } else if (x<270&&x>180) { System.out.println("Bearing is S "+ (x-180) +" W"); } else if (x<180&&x>90) { System.out.println("Bearing is S "+ (180-x) +" E"); } }
Editor is loading...