Question: File Edit Search View Encoding Language Settings Tools Macro Run Plugins Window pubiic class Furtheatcities public static void rain (String1 args) f /Each 2D array

 File Edit Search View Encoding Language Settings Tools Macro Run PluginsWindow pubiic class Furtheatcities public static void rain (String1 args) f /Each

File Edit Search View Encoding Language Settings Tools Macro Run Plugins Window pubiic class Furtheatcities public static void rain (String1 args) f /Each 2D array is of the forz. //citylx, cityly), (cityzx, cityzy int C cities022,-45,-20,-43,-45,29141,35,121,4,23,-37, 1,-19-44,-10,2, 15,,-30,2,35, -19 int [in citiesi-H34,,42,61,1-39 . 44 } , { 14,-49},{-42,363,{-50,121,130,131,115,-71,131,-331,110,1749,14),(27,-10},{-4,-19,i-17,-3},17,3},{37,36 } . {35,-263}; int [10 cities2-1112,-21},{15,11},{-41,L},{-47,12), (-18,-38 } , 14,0),(41,39),(34,0.-11,41)'(-10 ,6},{-e , 9h.CL,-46),(2,16.142 ,16}); int [ ] [] Cities3= {{31,-47},{_3 ,22},{27,411,1-39,-13 1,1-26,12).12,-47 1,138,-16},{-18,-27),(39,11), (43,-5),(13,-21),1-1,-10),1-28,-44),(8,9},1-4 , 31),1-30 , 31,1-27,-50), {-20,14)); int [ ] [] eities. H-14,18},(38,31,1-28,8},{-37,26},(36,41},{-46,-48),(-5,39),(-23,-231,15,10},{-33,3,{23,-36},{11,-27),{19,-17},{,17), {42,43), {-34,13),/-46,1-40,B}); int [in cities5 _ {132,-51,1-11,403, {-19,-48},{-19,301,133,-15},{-30 , 40 },{15,363, { 14, 4933; int [10 cities&-116,-6 1,19 ,40-{,1-1,11{,1-14,21{,}43,22(,}-27,5).42 , 27.12.-26.{-4,-40. {-29 ,43 } ,(41,14), (-13,20)); int t cLt1e7-48,-4, 123,-45,-7,-40,-28,31,13,241,123,-11),13,-10), -9,21) int [ ] [] eities8 {{-28,47},{-17,-42},{,39}.-20,12),{44,17 1,1-36,-13),(47,41),{-2,31),[38,-12),(39,13)); int [in cities3-11-40,-43},{19,18},{49,29},{-37,25},{-32,24},{44,5},{-39.-251,136,431,1-36,-31},{-50,25},{-16,6},{-47,-10},{16,35},{42,-,17,-19},{14,-13},{-37,39},{19,-34}}; 10 14 18 //These should be the correct values. Let me know if you thnk there are any error system . out.print 1n("Testing eitiesOshould be ~99.8248): + furthestDistance (eities 0)); System. out .print1n("Testing cities! should be ~107.042): + furthestDistance (cities!)); System.out.println ("Testing cities2 should be ~97.0061): - + furthestDistance {ctes2)); system . out.print 1n("le ting citie 3should be "105.815): . + furthestDistance (citie s 3)); system. out,print 1n("Testing eities4should be ~126.589):-+ furthestDistance (eities4)); System. out .print1n("Testing cities5 should be ~102.459): + furthestDistance (citie 55)); System.out, printIn("Testing cities& should be ~90.8735) : + furthestDistance {cities 6)); system . out.print 1n("le ting cities7should be "91.5259) : . + furthe stDistance (citie s 7)); system. out . print 1n("Testing eities8should be ~104.309):-+ furthestD stance {eitiesB)); System.out,print1n("Testing cities3 should be "l14. 769): " + furthestDistance (cities3)); 18 19 23 26 29 30 31 AIReturns the largest Euclidean distance betueen any two cities ithin the iies array public static double furthestDistanceint1 cities) return 0.0: 34 Activate Windows ate Windows file lenqth: 2,831 lines:34 Ln: 34 Col:1 Sel: 010 Windows (CR LF) UTF-8 INS Adobe Acrobat Professional [COMP1006B-W19-A1.1 Specification.pdf]) File Edit View Document Comments Tools Advanced Window Help . d ., create PDF Send for Review-B secure , 1 Sign search Comment & Markup d Forms Problem 2 (Furthest Cities) To start this probiem, download the FurthestCities ava file from the assignment page on culeam. You must implement the furthestDistance into cities) method in this file. The argument for the method wil be a 2-D amay containing city locations. Each element in the cties armay will be a 2-element integer aray containing the x and Y coordinates of a city. Your method must retum a double value representing the largest Euclidean distance between any COMP 10068-W19-A1. Due Thureday, January 24h at 11:55 PM two cties contained in the cities array. If there are less than 2 cities in the array, the method should return 0.0 Note, if city #1 is at location (x1,y1) and city #2 is at location (x2,y2), the Euclidean distance between them can be calculated as: You can use the Java Math package to perform the required calculations. You can also add additional methods to this fle as necessary (e.g., if you want to perfom distance calculations The main method contained in the template file has ten example arays with city locations, as well as test code that calls the furthes Distance method to compare the output value with the axpacted value. Note: you should test your method further uaing your own lists to enaure it functions correctly

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!