You are going to change the GeoPoint class from your lastprogram, but instead of only working with two points you are goingto read in a list of five or more points from a file.
1. Create a file that has the data for at least fivepoints.
2. Each line in the file should have each point’s lat and loncoordinates and a description. It could look like this:
100.200, 123.456, Main Campus
120.33, 142.345, Montoya
153.23, 322.345, Rio Rancho
133.23, 143.345, STEMULUS Center
153.42, 122.345, ATC
3. In the main part of your program do the following:
a. Create a list that you will use to collect the points.Something like pointsList = [].
b. Read points in from a file.
c. As you read lat lon and description from the file, use thosevalues to create a point and add that point to a List. Somethinglike: newPoint = GeoPoint(lat, lon, description)pointsList.append(newPoint)
d. Inside the “Do another (y/n)?” loop do the following:
i. Ask the user for their location.
ii. Create a point to represent the user’s location.
iii. Iterate through the point list and find the closestpoint.
iv. Tell the user which point they are closest to in thisformat: You are closest to which is located at
v. Ask “Do another (y/n)?” and loop if they respond with ‘y’
You are going to change the GeoPoint class from your last program, but instead of only working with two points you are g
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am