← Online Java Compiler - online X C 60 61 62 63 64 65 66 67 68 69 70 GPSCoordinateCo... : 1234576 7 78 79 77 80 81 82 83 84 85 86 } 87 88 89 ☀ onlinegdb.com/online_java_compiler# Run Debug } + if (direction double decimal Degrees Stop int seconds degrees } Share decimal Degrees -decimal Degrees; int direction if (direction degrees } System.out.println(decimal Degrees); } //FIX convertToDegreeMinsSeconds portion public static void convertToDegreeMinsSeconds (Scanner scnr){ System.out.print("Enter the decimal degrees (0 to 180): "); double degrees = scnr.nextInt(); int minutes scnr.nextInt(); scnr.nextInt(); = H Save degrees + (minutes / 60.0) + (seconds / 3600.0); 'S' || direction 'W'){ = {} Beautify Press ENTER to exit console. scnr.nextInt(); 'S' || direction -degrees; == 'W'){ degrees + (minutes* 60.0) + (seconds * 60.0); System.out.println(degrees + minutes + seconds); input Language Java 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 GPS coordinate program in Java. The first part converts to decimal degrees from degrees, minutes, and seconds. The second part converts to degrees, minutes, and seconds to decimal degrees. It also outputs the cardinal direction. I can't figure out how to create the second portion to convert to decimal degrees from DMS. 

This is what I have so far:

This is the 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: 3
Your menu selection is: 2
Enter the decimal degrees: 0 to 180: 30.26388888888889
0.2638888888888893
0
30 15 50.00000000000142 N OR E
Would you like to try another (Y/y or N/n to QUIT)?
N
Bye-bye

←
Online Java Compiler - online X
C
60
61
62
63
64
65
66
67
68
69
70
GPSCoordinateCo... :
1234576 7 78 79
77
80
81
82
83
84
85
86 }
87
88
89
☀
onlinegdb.com/online_java_compiler#
Run
Debug
}
+
if (direction
double decimal Degrees
Stop
int seconds
degrees
}
Share
decimal Degrees -decimal Degrees;
int direction
if (direction
degrees
}
System.out.println(decimal Degrees);
}
//FIX convertToDegreeMinsSeconds portion
public static void convertToDegreeMinsSeconds (Scanner scnr){
System.out.print("Enter the decimal degrees (0 to 180): ");
double degrees = scnr.nextInt();
int minutes scnr.nextInt();
scnr.nextInt();
=
H Save
degrees + (minutes / 60.0) + (seconds / 3600.0);
'S' || direction 'W'){
=
{} Beautify
Press ENTER to exit console.
scnr.nextInt();
'S' || direction
-degrees;
==
'W'){
degrees + (minutes* 60.0) + (seconds * 60.0);
System.out.println(degrees + minutes + seconds);
input
Language Java
JG
Transcribed Image Text:← Online Java Compiler - online X C 60 61 62 63 64 65 66 67 68 69 70 GPSCoordinateCo... : 1234576 7 78 79 77 80 81 82 83 84 85 86 } 87 88 89 ☀ onlinegdb.com/online_java_compiler# Run Debug } + if (direction double decimal Degrees Stop int seconds degrees } Share decimal Degrees -decimal Degrees; int direction if (direction degrees } System.out.println(decimal Degrees); } //FIX convertToDegreeMinsSeconds portion public static void convertToDegreeMinsSeconds (Scanner scnr){ System.out.print("Enter the decimal degrees (0 to 180): "); double degrees = scnr.nextInt(); int minutes scnr.nextInt(); scnr.nextInt(); = H Save degrees + (minutes / 60.0) + (seconds / 3600.0); 'S' || direction 'W'){ = {} Beautify Press ENTER to exit console. scnr.nextInt(); 'S' || direction -degrees; == 'W'){ degrees + (minutes* 60.0) + (seconds * 60.0); System.out.println(degrees + minutes + seconds); input Language Java JG
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

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