this method can be used to select all cities in the upper midwest that have population 100,000 or more.Python Programming

The text file contains

 

Youngstown, OH[4110,8065]115436 Yankton, SD[4288,9739]12011

966

Yakima, WA[4660,12051]49826 1513 2410

Worcester, MA[4227,7180]161799 2964 1520 604

Wisconsin Dells, WI[4363,8977]2521 1149 1817 481 595

Winston-Salem, NC[3610,8025]131885 927 729 2742 1289 494

Winnipeg, MB[4988,9715]564473 1611 686 1833 1446 550 1279

Winchester, VA[3919,7816]20217 1510 290 826 466 2641 1197 250 Wilmington, NC[3424,7792]139238

390 1823 214 1139 765 2956 1500 637

Wilmington, DE[3975,7555]70195

466 168 1618 430 934 299 2749 1305 345

Williston, ND[4815,10362]13336

1820 2027 1712 428 1813 888 2035 1061 663 1481

Williamsport, PA[4125,7700]33401

1718 172 567 201 1516 491 832 369 2647 1203 239

Williamson, WV[3768,8228]5219

504 1610 544 452 378 1408 240 724 843 2539 1071 353

Wichita Falls, TX[3390,9849]94201

1179 1500 1313 1574 1363 1432 1252 1246 1044 1848 1887 724 1284

Wichita, KS[3769,9734]279835

308 1002 1270 1068 1344 1360 1220 944 1192 748 1618 1774 416 1054

Wheeling, WV[4007,8072]43070

1017 1247 269 255 1513 327 589 203 1311 416 627 605 2442 998 85

West Palm Beach, FL[2672,8005]63305

1167 1550 1432 965 1249 2375 1160 718 1048 2175 760 1515 1459 3280 1794 1252

Wenatchee, WA[4742,12032]17257

3250 2390 1783 1948 2487 2595 1009 2697 2904 2589 1394 2690 1765 2912 117 1461

2358

Weed, CA[4142,12239]2879

622 3229 2678 1842 1850 2717 2898 1473 2981 3128 2880 1858 2935 2213 3213 505

1752 2659

Waycross, GA[3122,8235]19371

2947 2890 360 820 1192 1097 605 904 2015 828 386 703 1815 413 1155 112

 

 Introduction Name of the city

  • State of the city

 

  • Latitude and longitude of the city• Population of the city

 

  • Distances to all other cities
  1. selectCities(attribute, lowerBound, upperBound): This method will be used to “select” a set of cities that satisfy some For example, this method can be used to select all cities in the upper midwest that have population 100,000 or more. The argument attribute is a string that can be one of “name”, “state”, “latitude”, “longitude”, and “population.” Depending on the value of attribute, the arguments lowerBound and upperBound specify a range. So for example, if attribute is “population” then setting lowerBound to 100,000 and upperBound to 500,000 will select all cities whose population is between one hundred thousand and five hundred thousand (inclusive). Here is another example: if attribute is “name” then settinglowerBound to “R” and upperBound to “T” will select all cities whose names are lexicographically in the range between “R” and “T” (inclusive). These examples should indicate to you that while attribute is guaranteed to be a string, lowerBoundand upperBound will have different types, depending on the value of attribute.

An important property that selectCities is required to have is that it selects only from those cities that are already selected. This allows us to use selectCities repeat- edly to select a set of cities that satisfy several constraints. For example, we could first call selectCities(‘‘population’’, 100000, 500000) to select cities whose popu- lation is in the range 100,000 to 500,000. We could then call selectCities(‘‘name’’, ‘‘R’’, ‘‘T’’). This latter call would select cities with names between “R” and “T” from only among those cities already selected, i.e., those that have population in the range 100,000 to 500,000. As a result, the set of cities selected at this point is all cities with names between “R” and “T,” whose population is in the range 100,000 to 500,000. You should be able to see that by calling selectCities repeatedly, one can select a set of cities that satisfy several constraints, e.g., all cities in California whose names start with ”S” and which have population more than 200,000.

  1. selectAllCities() and unselectAllCities(): These methods respectively select and unselect all
  2. selectEdges(lowerBound, upperBound): Here lowerBound and upperBound spec- ify a “distance range.” For example, if lowerBound is set to 0 and upperBound is set to 500, this method will select all edges between pairs of cities whose distance (as specified in

 

gis.dat) is at most 500 miles. For now the only criteria we will use to select edges is this distance criteria. Assume that initially no edges are selected.

Attachments:

Instructions Files

Python Programming Experts

expert
Issac Torres
Python Programming

67 Answers

expert
Oliver
Python Programming

60 Answers

View More Experts
Disclaimer

The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.

Get Free Quote!

259 Experts Online