Question: Part 2 : Decimal Degrees Cleaning up the Data The function will do these things: Make sure the degrees and minutes are integer, using (

Part 2: Decimal Degrees Cleaning up the Data
The function will do these things:
Make sure the degrees and minutes are integer, using (Seconds can be floating point.)
Make sure the minutes and seconds are positive numbers (Degrees can be negative. Hint:
use
If the minutes and seconds are greater than 59, process it as if the numbers had "rolled over"
correctly. Thus, if someone enters 27173', and 97'', that is the same as 2954'37''.(Hint:
you can do this without any if statements or any special code at all, if you set up the
conversion math correctly.)
Note that degrees can be negative. Make sure you handle the calculation properly!
The following shows the output from running the program several times. Your program's
output does not have to look exactly like this, but it must convey the same information. User
input is shown in bold italic to distinguish it from the program's output.
Enter degrees: 132
Enter minutes: 0
Enter seconds: 45
That is 132.0125 decimal degrees.
Enter degrees: -45
Enter minutes: 30
Enter seconds: 0
That is -45.5 decimal degrees.
Enter degrees: 27
Enter minutes: 173
Enter seconds: 97
That is 29.910277777777778 decimal degrees.
An angles degrees can be specified as a decimal (such as 27.5) or in degrees-minutes-seconds format (27\deg 300).
Your program, named in the form lastname_firstname_degrees.py will ask for the a number of degrees, minutes and seconds. It will then pass those three values to a function named to_decimal, which will convert it to a decimal value and return it. Your program will then print the decimal value, properly labeled.
Cleaning up the Data
The to_decimal function will do these things:
Make sure the degrees and minutes are integer, using int. (Seconds can be floating point.)
Make sure the minutes and seconds are positive numbers (Degrees can be negative. Hint: use abs)
If the minutes and seconds are greater than 59, process it as if the numbers had rolled over correctly. Thus, if someone enters 27\deg 173, and 97, that is the same as 29\deg 5437.(Hint: you can do this without any if statements or any special code at all, if you set up the conversion math correctly.)
Note that degrees can be negative. Make sure you handle the calculation properly!
The following shows the output from running the program several times. Your program's output does not have to look exactly like this, but it must convey the same information. User input is shown in bold italic to distinguish it from the program's output.
Enter degrees: 132
Enter minutes: 0
Enter seconds: 45
That is 132.0125 decimal degrees.
Enter degrees: -45
Enter minutes: 30
Enter seconds: 0
That is -45.5 decimal degrees.
Enter degrees: 27
Enter minutes: 173
Enter seconds: 97
That is 29.91027777777778 decimal degrees.
Part 2 : Decimal Degrees Cleaning up the Data The

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!