do{
System.out.println("Please enter a True Bearing:");
Scanner A = new Scanner(System.in);
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");
}
System.out.println("Do you wish to continue? (y/n)");
String S = A.next().toUpperCase();
}
while(S.equals("Y"));
}
}