← 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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I am writing a program in Java that uses a menu to convert from decimal form to traditional form and back in GPS coordinates. When the user enters y the program runs again from the start. If a number outside of the 180 range for degrees is entered program skips that input. If a number outside of 0-60 for minutes range is entered program skips that input. 

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:

←
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
Transcribed Image Text:← 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
Expert Solution
steps

Step by step

Solved in 1 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education