Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE WRITE IN PYTHON (python3) This problem has two parts. The second needs the first. 1. Write a python script that randomly generates latitude, longitude,

PLEASE WRITE IN PYTHON (python3)
This problem has two parts. The second needs the first.
1. Write a python script that randomly generates latitude, longitude, and compositions for five meteorite landing sites. The requirements:
- generate five random pairs of latitudes (between 16.0 - 18.0 degrees north) and longitudes (between 82.0 - 84.0 degrees East) in decimal notation
- for each site, randomly choose a meteorite composition from the following list ["stony", "iron", "stony-iron"]
- assemble this data into a dictionary with one key "sites" whose value is a list of dictionaries
- use python json library to save data in a json file. Below is an example of what it should look like
image text in transcribed
2. Write a new python script that reads the json file and calculates time required to visit and take samples from the five sites in order.
- this script should use the json library to read in data generated in 1 and store it as dictionary
- assume the robot starts at lat/long {16.0, 82.0}
- assume the max robot speed is 10 km/hr
- assume mars is a sphere with radius 3389.5 km Use the great circle distance algorithm to calculate the distance between points.
optional function for this below.
- when robot stops to take samples, the amount of time it stops is dependant on the composition of the material. Stony=1 hr, Iron=2 hrs, Stony-Iron=3 hrs
- the trip is over when the robot has visited the last meteorite.
- print some info for each leg of the trip and a summary info for the whole trip. A sample is below.
image text in transcribed
image text in transcribed
"sites": [ "site_id": 1, "latitude": 17.93705170143149, "longitude": 83.36448444826725, "composition": "stony" \}, \{ "site_id": 2, "latitude": 16.714833623042153, "longitude": 82.84554246756586, "composition": "iron" \}, etc \[ \text { mars_radius }=3389.5 \quad \text { \# km } \] def calc_gcd(latitude_1: float, longitude_1: float, latitude_2: float, longitude_2: float) - > float: lat1, lon1, lat2, lon2 = map( aath, radians, [latitude 1, longitude 1, latitude 2, longitude.2] ) d_sigma = math.acos ( math.sin(lat1) * math. sin( lat 2) + math. cos(1at1) math. cos( lat2) " math. cos(ab5(1on11on2)) ) return ( mars_radius " d_sigaa) leg=1,timetotravel=11.75hr,timetosample=1hrleg=2,timetotravel=3.43hr,timetosample=2hrleg=3,timetotravel=4.53hr,timetosample=1hrleg=4,timetotravel=6.04hr,timetosample=2hrleg=5,timetotravel=10.43hr,timetosample=3hr number of legs =5, total time elapsed =45.17hr

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions