Add comments as appropriate. Be sure that your program output is neatly presented to the user.  Add documentation comments to your functions. You are going to change the class you created in Program7 so that it has a constructor and some properties. In your GeoPoint class make the following changes (note your variable, parameter and method names may be different. Adjust as needed.): Add a constructor __init__(self, lat=0, lon=0,description = ‘TBD’) that will initialize the class variables __lat ,__lon and the __description. Notice that the constructor will also default lat and lon to zero and description to ‘TBD’ if they are not provided. Change the SetPoint method so that instead of individual coordinates SetPoint(self, lat, lon) it takes a single sequence. Add a property: Point = property(GetPoint,SetPoint). Make sure GetPoint and SetPoint are the names you used for the get and set methods you already wrote for points. Add another property: Description = property(GetDescription, SetDescription). Make sure GetDescription and SetDescription are the names you used for the get and set methods you already wrote. Change the distance method so that it takes a point instead of coordinates: Distance(self, toPoint) instead of Distance(self, lat, lon). You will put your class in a separate library file. You will use an #include statement from the main part of your program. In the main part of your program do the following: Include the class from the library file. Instantiate two points Instead of using SetPoint and SetDescription methods to set each of the points locations and descriptions do the following: Use the constructor to set point1 coordinates and description. It should look something like the following but with your own coordinates and description: point1 = GeoPoint(12.3456,-123.4567,'Loc1') Use a constructor without any arguments to instantiate the second point and use it’s properties to set it’s values. It should look something like the following but with your own coordinates and description: point2 = GeoPoint() point2.PointCoords = 23.4567, -213.456 point2.PointDescription = 'Loc2'   Inside the “Do another (y/n)?” loop do the following: Ask the user for their location.   Create a third point to represent the user’s location. You can use either the constructor or properties. With a constructor it will look like: pointUser = GeoPoint(lat,lon, 'User Location') Use point1 and point2’s Distance method to find the distance from each point to the user’s location. Notice we are passing in the users point rather than the separate coordinates: distanceToOne = point1.Distance(pointUser) distanceToTwo = point2.Distance(pointUser) Tell the user which point they are closest to in this format: You are closest to which is located at Ask “Do another (y/n)?” and loop if they respond with ‘y’

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter10: Classes And Objects
Section: Chapter Questions
Problem 5RQ: Which of the following statements is false? a. A class can contain only one constructor. b. An...
icon
Related questions
Question
  1.  Add comments as appropriate. Be sure that your program output is neatly presented to the user.  Add documentation comments to your functions.
  2. You are going to change the class you created in Program7 so that it has a constructor and some properties.
  3. In your GeoPoint class make the following changes (note your variable, parameter and method names may be different. Adjust as needed.):
    1. Add a constructor __init__(self, lat=0, lon=0,description = ‘TBD’) that will initialize the class variables __lat ,__lon and the __description. Notice that the constructor will also default lat and lon to zero and description to ‘TBD’ if they are not provided.
    2. Change the SetPoint method so that instead of individual coordinates SetPoint(self, lat, lon) it takes a single sequence.
    3. Add a property: Point = property(GetPoint,SetPoint). Make sure GetPoint and SetPoint are the names you used for the get and set methods you already wrote for points.
    4. Add another property: Description = property(GetDescription, SetDescription). Make sure GetDescription and SetDescription are the names you used for the get and set methods you already wrote.
    5. Change the distance method so that it takes a point instead of coordinates: Distance(self, toPoint) instead of Distance(self, lat, lon).
  4. You will put your class in a separate library file. You will use an #include statement from the main part of your program.
  5. In the main part of your program do the following:
    1. Include the class from the library file.
    2. Instantiate two points
    3. Instead of using SetPoint and SetDescription methods to set each of the points locations and descriptions do the following:
      1. Use the constructor to set point1 coordinates and description. It should look something like the following but with your own coordinates and description:

point1 = GeoPoint(12.3456,-123.4567,'Loc1')

  1. Use a constructor without any arguments to instantiate the second point and use it’s properties to set it’s values. It should look something like the following but with your own coordinates and description:

point2 = GeoPoint()

point2.PointCoords = 23.4567, -213.456

point2.PointDescription = 'Loc2'

 

  1. Inside the “Do another (y/n)?” loop do the following:
    1. Ask the user for their location.

 

  1. Create a third point to represent the user’s location. You can use either the constructor or properties. With a constructor it will look like:

pointUser = GeoPoint(lat,lon, 'User Location')

  1. Use point1 and point2’s Distance method to find the distance from each point to the user’s location. Notice we are passing in the users point rather than the separate coordinates:

distanceToOne = point1.Distance(pointUser)

distanceToTwo = point2.Distance(pointUser)

  1. Tell the user which point they are closest to in this format:

You are closest to <description> which is located at <point’s x, y, z coordinates>

  1. Ask “Do another (y/n)?” and loop if they respond with ‘y’
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning