← Online Java Compiler - online X + C GPSCoordinateCo... : 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 onlinegdb.com/online_java_compiler Run ☀ 6 7 public class GPSCoordinateConverter 8 9- { } Debug Stop Share H Save {} Beautify } public static void main(String[] args) { System.out.println("This program converts between two GPS coordinate systems: "); System.out.println("1. degrees, minutes, and seconds with a cardinal direction (N, S, E W) to decimal degrees"); System.out.println("2. decimal degrees to degrees, minutes, and seconds with a cardinal direction (N, S, E, W)"); Scanner scnr new Scanner(System.in); int i; System.out.println("Your menu selection is: "); int getUserInput scnr.nextInt(); System.out.println("Enter the decimal degrees (0 to 180): "); double UserInput Degrees = scnr.nextInt(); System.out.println("Enter the minutes (0 to 60): "); double UserInputMinutes = scnr.nextInt(); System.out.println("Enter the seconds (0 to 60): "); double UserInputSeconds = scnr.nextInt(); Language Java input JG
I am writing a
Output I'm Looking for:
This program converts between two GPS coordinate systems:
1. degrees, minutes and seconds with a cardinal direction (N, S, E W) to decimal degrees
2. decimal degrees to degrees, minutes and seconds with a cardinal direction (N, S, E, W)
Your menu selection is: 4
Your menu selection is: 3
Your menu selection is: 1
Enter the degrees: 0 to 180: 185
Enter the degrees: 0 to 180: 30
Enter the minutes: 0 to 60: 65
Enter the minutes: 0 to 60: 64
Enter the minutes: 0 to 60: 15
Enter the seconds: 0 to 60: 63
Enter the seconds: 0 to 60: 50
Enter the cardinal direction (N, S, E, W): N
30.26388888888889
Would you like to try another (Y/y or N/n to QUIT)?
y (program runs again asking for new input)
This is the code I have so far:
Step by step
Solved in 1 steps