Question: IN JAVA public static void main(String[] args) 1+ import java.util.ArrayList;. 30 /* 4 * This program finds the largest and smallest numbers in an array

IN JAVA IN JAVA public static void main(String[] args) 1+ import java.util.ArrayList;. 30

public static void main(String[] args) 1+ import java.util.ArrayList;. 30 /* 4 * This program finds the largest and smallest numbers in an array list of integers 5 */ 6 public class FindMinAndMax 7 80 9 10 String data = "45 72 35 90 12 3 204 317 684 23 44"; 11 ArrayList values = new ArrayList(); 12 13 Scanner in = new Scanner(data); 14 while (in.hasNextInt() 15 { 16 values.add(in.nextInt()); 17 } 18 19 // Find the largest and smallest value in array list values 20 int largest = values.get(0); 21 int smallest = values.get(0); 22 //-- -Start below here. To do: approximate lines of code = 5 23 // Loop through the remaining integer elements in values and update largest and smallest 24 25 26 27 28 29 30 31 32 1/ -End here. Please do not remove this comment. Reminder: no changes outside the todo regions. 33 System.out.println("Largest = " + largest + " Smallest = " + smallest); 34 System.out.println("Expected: Largest = 684 Smallest = 3"); 35 } 36 37 }

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!