Question
Question 01 : The longitude of a geographic location can be expressed in one the following three formats: Decimal degrees. Example: 50.15395 Degrees, minutes, and
Question 01: The longitude of a geographic location can be expressed in one the following three formats:
Decimal degrees. Example: 50.15395
Degrees, minutes, and seconds. Example: 50 9 14.220000
Degrees and minutes. Example: 50 9.237000
Write an interactive Java program, containing the main function only, which displays the following menu:
Decimal degree input
Degrees, minutes, and seconds input
Degrees and Minutes input
It then prompts the user to select his input choice and reads that choice. If the choice is invalid your program must display an appropriate error message and terminate; otherwise it reads the input. If the input is invalid your program must display an appropriate error message and terminate; otherwise it converts the input to each of the other two longitude formats and then displays each one of these formats.
:
Your program must handle InputMismatchException by displaying an appropriate error message.
Your program must be general and it must behave as in the sample program runs below.
:
A longitude can have values from 0 degrees to 180 degrees inclusive, i.e., 0 degrees 180
1 degree = 60 minutes, 1 minute = 60 seconds.
A minute can have values in the interval [0 . . . 60), i.e., 0 minutes
A second can have values in the interval [0 . . . 60), i.e., 0 seconds
: For choice 2, the input must be two integers followed by a floating point value.
For choice 3, the input must be an integer followed by a floating point value
Enter you input choice: 1. Decimal degrees 2. Degrees, Minutes, and Seconds 3. Degrees and Minutes Enter Degrees, Minutes, and Seconds: 50 9 14.220000 Output in Degrees and Minutes is: 50, 9.237000 Output in decimal degrees is: 50.153950Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started