Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Small oop test

NotificationsYou must be signed in to change notification settings

Agilefreaks/test_oop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

You have been hired by a company that builds a mobile app for coffee addicts. You areresponsible for taking the user’s location and returning a list of the three closest coffee shops.

Input

The coffee shop list is a comma separated file with rows of the following form:Name,Y Coordinate,X Coordinate

The quality of data in this list of coffee shops may vary. Malformed entries should cause theprogram to exit appropriately.

Your program will be executed directly from the command line and will be provided threearguments in the following order:<user x coordinate> <user y coordinate> <shop data url>

Notice that the data file will be read from an network location (ex:https://raw.githubusercontent.com/Agilefreaks/test_oop/master/coffee_shops.csv)

Output

Write a program that takes the user’s coordinates encoded as listed above and prints out anewline­separated list of the three closest coffee shops (including distance from the user) inorder of closest to farthest. These distances should be rounded to four decimal places.

Assume all coordinates lie on a plane.

Example

Using thecoffee_shops.csv

Input

47.6 -122.4 coffee_shops.csv

Expected output

Starbucks Seattle2,0.0645Starbucks Seattle,0.0861Starbucks SF,10.0793

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp