View the step-by-step solution to:

Question

2. Distance / POI Density Package

Package a collection of functions, procedures, and constants (outlined

below) that allow the determination of distance and density for Persons of Interest to Eagle Electronics.

The package should be named: HW03

Note: the package must compile for it to be graded. If the package does NOT compile, a score of 0 will be given for question 2.

2a

Create a function named DEGREES_TO_RADIANS that converts a numeric value from degrees to radians.

This function should only be internally accessible to the HW03 package (e.g., accessible from within the package).

5 pts.

2b

Create a function named KM_TO_MILES that converts a numeric value from kilometers to miles.

This function should be publically accessible to any able to use the HW03 package.

5 pts.

2c

Create an overloaded function named DISTANCE_BETWEEN_ZIPS that calculates the number of kilometers between any two zip codes.

The function should:

• accept two parameters (the two zip codes)

• return a numeric distance in kilometers

• use the DEGREES_TO_RADIANS function (question 2a)

• returns a value of -1 if one or both of the zip codes provided is not in the database

• possesses a general exception handler

This function should be publically accessible to any able to use the HW03 package.

Note: Use a Haversine formula when calculating distances on this scale. Several

are available online.


Create an overloaded function named DISTANCE_BETWEEN_ZIPS that

calculates the number of kilometers between Eagle Electronics (located in zip

code '33605') and any other zip code.

The function should:

• accept one parameter (the zip code)

• return a numeric distance in kilometers

• use the DEGREES_TO_RADIANS function (question 2a)

• returns a value of -1 if one or both of the zip codes provided is not in the

database

• possesses a general exception handler

This function should be publically accessible to any able to use the HW03

package.

Note: no partial credit is available for this question unless Question 2c has been

successfully completed.

2 pts.

2e Create a procedure named POI_WITHIN_DISTANCE that prints out all the

persons of interest within the specified radius.

This procedure should:

• accept a single parameter (distance in miles)

• identify (e.g., print out) all persons of interest within the specified

distance from Eagle Electronics. Include:

o the name of the individual in 'Lastname, Firstname' format

o the appropriate company name (company name, supplier name,

Eagle Electronics, etc.)

o type of person of interest (e.g., Commercial Customer, Supplier,

etc.)

o city

o distance

• use one of the DISTANCE_BETWEEN_ZIPS functions (question 2c or

2d)

• use a function to translate distance (either 'km to miles' or 'miles to km')

• possesses a general exception handler

This function should be publically accessible to any able to use the HW03

package.

Note: no partial credit is available for this question unless Question 2c has been

successfully completed.

8 pts.

2f Create a function named POI_DENSITY that calculates the number of persons of interest within the specified radius.

The function should:

• accept a single parameter (distance in miles)

• return the number of persons of interest within the specified distance from

Eagle Electronics

• use one of the DISTANCE_BETWEEN_ZIPS functions

• use a function to translate distance (either 'km to miles' or 'miles to km')

• possesses a general exception handler

This function should be publically accessible to any able to use the HW03

package.

Note: no partial credit is available for this question unless Question 2c has been

successfully completed.

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes