Compute the distance between the positions of the first and last zero element in the given array. For example if the array is XXXXXXXXXXyour algorithm should yield 7 - 1 = 6. If the array contains a...

Compute the distance between the positions of the first and last zero element in the given array. For example if the array is 3 0 1 0 4 9 5 0 6 your algorithm should yield 7 - 1 = 6. If the array contains a single zero return 0. If it doesn’t contain any zeros return a negative value Only edit code within the /*Your code goes here*/ portion.) src)<br>Numbers<br>PasswordGenerator.java =<br>PrintDemo.java X<br>A G Pyramids.java ×<br>Prog06_PartyPooper.java X<br>public class Numbers<br>CObes<br>1<br>DoLoop<br>2<br>G Doublelnvesti<br>G DuplicatedCh 3 @<br>G EarthquakeSt 4<br>GElevatorSimul 5<br>public static int zeroesDistance(double[] values)<br>{<br>int firstPos = 0;<br>int lastPos = values. Length - 1;<br>Error1<br>6<br>Error2<br>7<br>boolean found = false;<br>G Error3<br>while (firstPos < values.length && !found)<br>8<br>O FindSpaces<br>9<br>A FirstVowel.jav<br>/* Your code goes here */<br>10<br>G Geometry<br>G Grades<br>11<br>12<br>return lastPos - firstPos;<br>HelloPrinter<br>G IntegerName| 13<br>G InvestmentTal 14<br>l joh661.zip<br>Numbers<br>PasswordGen<br>G PowerTable<br>G PrintDemo<br>PrintTableDer<br>G Prog06_Party<br>G Pyramids<br>G RandomDemd<br>GReadTime<br>GReciprocalSu<br>RemoveDupli<br>G SentinelDemd<br>> G Seperators.ja<br>G Shipping<br>G TaxCalculator<br>G test<br>UniqueChars<br>Velumed<br>Run:<br>O ArrayDemo x<br>ZUsers/jacobjohnston/Library/Java/JavaVirtualMachines/openidk-16.0.2/Contents/Home/bin/java -j-<br>0 246 8<br>Fred Amy Cindy Henry<br>42 2 4 6 8<br>Enter scores, -1 to quit:<br>12 25 20 0 10 -1<br>You entered the following scores:<br>12 25 20 0 10<br>Process finished with exit code 0<br>E TODO<br>O All files are up-to-date (10/30/21, 2:15 PM)<br>> Run<br>O Problems<br>2 Terminal<br>K Build<br>* Favorites<br>Structure<br>4/- 印|1|大<br>

Extracted text: ) src) Numbers PasswordGenerator.java = PrintDemo.java X A G Pyramids.java × Prog06_PartyPooper.java X public class Numbers CObes 1 DoLoop 2 G Doublelnvesti G DuplicatedCh 3 @ G EarthquakeSt 4 GElevatorSimul 5 public static int zeroesDistance(double[] values) { int firstPos = 0; int lastPos = values. Length - 1; Error1 6 Error2 7 boolean found = false; G Error3 while (firstPos < values.length="" &&="" !found)="" 8="" o="" findspaces="" 9="" a="" firstvowel.jav="" *="" your="" code="" goes="" here="" */="" 10="" g="" geometry="" g="" grades="" 11="" 12="" return="" lastpos="" -="" firstpos;="" helloprinter="" g="" integername|="" 13="" g="" investmenttal="" 14="" l="" joh661.zip="" numbers="" passwordgen="" g="" powertable="" g="" printdemo="" printtableder="" g="" prog06_party="" g="" pyramids="" g="" randomdemd="" greadtime="" greciprocalsu="" removedupli="" g="" sentineldemd=""> G Seperators.ja G Shipping G TaxCalculator G test UniqueChars Velumed Run: O ArrayDemo x ZUsers/jacobjohnston/Library/Java/JavaVirtualMachines/openidk-16.0.2/Contents/Home/bin/java -j- 0 246 8 Fred Amy Cindy Henry 42 2 4 6 8 Enter scores, -1 to quit: 12 25 20 0 10 -1 You entered the following scores: 12 25 20 0 10 Process finished with exit code 0 E TODO O All files are up-to-date (10/30/21, 2:15 PM) > Run O Problems 2 Terminal K Build * Favorites Structure 4/- 印|1|大
Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here